pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1780090 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox: pdmodel/graphics/image/SampledImageReader.java rendering/PageDrawer.java
Date Tue, 24 Jan 2017 16:48:49 GMT
Author: tilman
Date: Tue Jan 24 16:48:49 2017
New Revision: 1780090

URL: http://svn.apache.org/viewvc?rev=1780090&view=rev
Log:
PDFBOX-1958: use int instead of float, remove TODO

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java?rev=1780090&r1=1780089&r2=1780090&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java
Tue Jan 24 16:48:49 2017
@@ -81,8 +81,8 @@ final class SampledImageReader
         WritableRaster raster = masked.getRaster();
         WritableRaster alpha = mask.getRaster();
 
-        final float[] transparent = new float[4];
-        float[] alphaPixel = null;
+        final int[] transparent = new int[4];
+        int[] alphaPixel = null;
         for (int y = 0; y < height; y++)
         {
             for (int x = 0; x < width; x++)

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1780090&r1=1780089&r2=1780090&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Tue Jan
24 16:48:49 2017
@@ -822,14 +822,15 @@ public class PageDrawer extends PDFGraph
         {
             if (getGraphicsState().getNonStrokingColor().getColorSpace() instanceof PDPattern)
             {
-                // the earlier code for stencils (see "else") doesn't work with patterns
because the
+                // The earlier code for stencils (see "else") doesn't work with patterns
because the
                 // CTM is not taken into consideration.
                 // this code is based on the fact that it is easily possible to draw the
mask and 
                 // the paint at the correct place with the existing code, but not in one
step.
-                // so what we do is to draw both in separate images, then combine the two
and draw
+                // Thus what we do is to draw both in separate images, then combine the two
and draw
                 // the result. 
-                //TODO: take device scale into consideration, so that some patterns can get
better
-                // at higher resolutions.
+                // Note that the device scale is not used. In theory, some patterns can get
better
+                // at higher resolutions but the stencil would become more and more "blocky".
+                // If anybody wants to do this, have a look at the code in showTransparencyGroup().
 
                 // draw the paint
                 Paint paint = getNonStrokingPaint();
@@ -858,8 +859,9 @@ public class PageDrawer extends PDFGraph
                 g.drawImage(mask, imageTransform, null);
                 g.dispose();
 
-                final float[] transparent = new float[4];
-                float[] alphaPixel = null;
+                // apply the mask
+                final int[] transparent = new int[4];
+                int[] alphaPixel = null;
                 WritableRaster raster = renderedPaint.getRaster();
                 WritableRaster alpha = renderedMask.getRaster();
                 int h = renderedMask.getRaster().getHeight();
@@ -875,6 +877,8 @@ public class PageDrawer extends PDFGraph
                         }
                     }
                 }
+                
+                // draw the image
                 setClip();
                 graphics.setComposite(getGraphicsState().getNonStrokingJavaComposite());
                 graphics.drawImage(renderedPaint, 



Mime
View raw message