pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1858056 - in /pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox: pdmodel/graphics/form/PDTransparencyGroupAttributes.java rendering/PageDrawer.java
Date Wed, 24 Apr 2019 14:48:02 GMT
Author: tilman
Date: Wed Apr 24 14:48:02 2019
New Revision: 1858056

URL: http://svn.apache.org/viewvc?rev=1858056&view=rev
Log:
PDFBOX-4525: pass the resources to profit from the resource cache when creating the colorspace

Modified:
    pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java
    pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java

Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java?rev=1858056&r1=1858055&r2=1858056&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java
(original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java
Wed Apr 24 14:48:02 2019
@@ -20,6 +20,7 @@ import java.io.IOException;
 
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.pdmodel.PDResources;
 import org.apache.pdfbox.pdmodel.common.COSObjectable;
 import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace;
 
@@ -65,9 +66,21 @@ public final class PDTransparencyGroupAt
      */
     public PDColorSpace getColorSpace() throws IOException
     {
+        return getColorSpace(null);
+    }
+
+    /**
+     * Returns the group color space or null if it isn't defined.
+     *
+     * @param resources useful for its cache. Can be null.
+     * @return the group color space.
+     * @throws IOException
+     */
+    public PDColorSpace getColorSpace(PDResources resources) throws IOException
+    {
         if (colorSpace == null && getCOSObject().containsKey(COSName.CS))
         {
-            colorSpace = PDColorSpace.create(getCOSObject().getDictionaryObject(COSName.CS));
+            colorSpace = PDColorSpace.create(getCOSObject().getDictionaryObject(COSName.CS),
resources);
         }
         return colorSpace;
     }

Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1858056&r1=1858055&r2=1858056&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
(original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Wed Apr 24 14:48:02 2019
@@ -1663,7 +1663,7 @@ public class PageDrawer extends PDFGraph
             height = maxY - minY;
 
             // FIXME - color space
-            if (isGray(form.getGroup().getColorSpace()))
+            if (isGray(form.getGroup().getColorSpace(form.getResources())))
             {
                 image = create2ByteGrayAlphaImage(width, height);
             }



Mime
View raw message