pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1771336 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
Date Fri, 25 Nov 2016 16:22:25 GMT
Author: tilman
Date: Fri Nov 25 16:22:25 2016
New Revision: 1771336

URL: http://svn.apache.org/viewvc?rev=1771336&view=rev
Log:
PDFBOX-3000: initialize transparency group processing as requested by the PDF specification

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java?rev=1771336&r1=1771335&r2=1771336&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
Fri Nov 25 16:22:25 2016
@@ -61,6 +61,7 @@ import org.apache.pdfbox.util.Matrix;
 import org.apache.pdfbox.util.Vector;
 import org.apache.pdfbox.contentstream.operator.Operator;
 import org.apache.pdfbox.contentstream.operator.OperatorProcessor;
+import org.apache.pdfbox.pdmodel.graphics.blend.BlendMode;
 
 /**
  * Processes a PDF content stream and executes certain operations.
@@ -180,6 +181,8 @@ public abstract class PDFStreamEngine
 
     /**
      * Processes a soft mask transparency group stream.
+     * @param group
+     * @throws IOException
      */
     protected void processSoftMask(PDTransparencyGroup group) throws IOException
     {
@@ -190,6 +193,8 @@ public abstract class PDFStreamEngine
 
     /**
      * Processes a transparency group stream.
+     * @param group
+     * @throws IOException
      */
     protected void processTransparencyGroup(PDTransparencyGroup group) throws IOException
     {
@@ -205,7 +210,12 @@ public abstract class PDFStreamEngine
         // transform the CTM using the stream's matrix
         getGraphicsState().getCurrentTransformationMatrix().concatenate(group.getMatrix());
 
-        // clear the current soft mask (this mask) to avoid recursion / unwanted effects
+        // Before execution of the transparency group XObject’s content stream, 
+        // the current blend mode in the graphics state shall be initialized to Normal, 
+        // the current stroking and nonstroking alpha constants to 1.0, and the current soft
mask to None.
+        getGraphicsState().setBlendMode(BlendMode.NORMAL);
+        getGraphicsState().setAlphaConstant(1);
+        getGraphicsState().setNonStrokeAlphaConstants(1);
         getGraphicsState().setSoftMask(null);
 
         // clip to bounding box



Mime
View raw message