You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2015/09/26 15:38:33 UTC

svn commit: r1705452 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form: PDFormXObject.java PDGroup.java PDTransparencyGroupAttributes.java

Author: tilman
Date: Sat Sep 26 13:38:32 2015
New Revision: 1705452

URL: http://svn.apache.org/viewvc?rev=1705452&view=rev
Log:
PDFBOX-2423, PDFBOX-2994: rename PDGroup to PDTransparencyGroupAttributes, as suggested by John Hewson

Added:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java   (with props)
Removed:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDGroup.java
Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java?rev=1705452&r1=1705451&r2=1705452&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java Sat Sep 26 13:38:32 2015
@@ -54,7 +54,7 @@ final and all fields private.
  */
 public class PDFormXObject extends PDXObject implements PDContentStream
 {
-    private PDGroup group;
+    private PDTransparencyGroupAttributes group;
     private final ResourceCache cache;
 
     /**
@@ -116,18 +116,18 @@ public class PDFormXObject extends PDXOb
     }
 
     /**
-     * Returns the group attributes dictionary (Group XObject).
+     * Returns the group attributes dictionary.
      *
      * @return the group attributes dictionary
      */
-    public PDGroup getGroup()
+    public PDTransparencyGroupAttributes getGroup()
     {
         if( group == null ) 
         {
             COSDictionary dic = (COSDictionary) getCOSStream().getDictionaryObject(COSName.GROUP);
             if( dic != null ) 
             {
-                group = new PDGroup(dic);
+                group = new PDTransparencyGroupAttributes(dic);
             }
         }
         return group;

Added: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java?rev=1705452&view=auto
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java (added)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java Sat Sep 26 13:38:32 2015
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.pdmodel.graphics.form;
+
+import java.io.IOException;
+
+import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.pdmodel.common.COSObjectable;
+import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace;
+
+/**
+ * Transparency group attributes.
+ * 
+ * @author Kühn & Weyh Software, GmbH
+ */
+public final class PDTransparencyGroupAttributes implements COSObjectable
+{
+    private final COSDictionary dictionary;
+    private PDColorSpace colorSpace;
+
+    /**
+     * Creates a group object from a given dictionary
+     * @param dic {@link COSDictionary} object
+     */
+    public PDTransparencyGroupAttributes(COSDictionary dic)
+    {
+        dictionary = dic;
+    }
+
+    @Override
+    public COSDictionary getCOSObject()
+    {
+        return dictionary;
+    }
+
+    /**
+     * Returns the blending color space
+     * @return color space
+     * @throws IOException
+     */
+    public PDColorSpace getColorSpace() throws IOException
+    {
+        if (colorSpace == null)
+        {
+            colorSpace = PDColorSpace.create(getCOSObject().getDictionaryObject(COSName.CS));
+        }
+        return colorSpace;
+    }
+
+    /**
+     * Returns true if this group is isolated. Isolated groups begin with the fully transparent
+     * image, non-isolated begin with the current backdrop.
+     */
+    public boolean isIsolated()
+    {
+        return getCOSObject().getBoolean(COSName.I, false);
+    }
+
+    /**
+     * Returns true if this group is a knockout. A knockout group blends with original backdrop,
+     * a non-knockout group blends with the current backdrop.
+     */
+    public boolean isKnockout()
+    {
+        return getCOSObject().getBoolean(COSName.K, false);
+    }
+}

Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java
------------------------------------------------------------------------------
    svn:eol-style = native