pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1722924 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java
Date Mon, 04 Jan 2016 17:33:19 GMT
Author: tilman
Date: Mon Jan  4 17:33:19 2016
New Revision: 1722924

URL: http://svn.apache.org/viewvc?rev=1722924&view=rev
Log:
PDFBOX-3181: use width and height directly from raster

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java?rev=1722924&r1=1722923&r2=1722924&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java
Mon Jan  4 17:33:19 2016
@@ -128,10 +128,10 @@ public final class LosslessFactory
     private static PDImageXObject createAlphaFromARGBImage(PDDocument document, BufferedImage
image)
             throws IOException
     {
-        // this implementation makes the assumption that the raster uses 
-        // SinglePixelPackedSampleModel, i.e. the values can be used 1:1 for
+        // this implementation makes the assumption that the raster values can be used 1:1
for
         // the stream. 
-        // Sadly the type of the databuffer is TYPE_INT and not TYPE_BYTE.
+        // Sadly the type of the databuffer is usually TYPE_INT and not TYPE_BYTE so we can't
just
+        // save it directly
         if (!image.getColorModel().hasAlpha())
         {
             return null;
@@ -146,8 +146,8 @@ public final class LosslessFactory
         }
 
         int[] pixels = alphaRaster.getPixels(0, 0,
-                alphaRaster.getSampleModel().getWidth(),
-                alphaRaster.getSampleModel().getHeight(),
+                alphaRaster.getWidth(),
+                alphaRaster.getHeight(),
                 (int[]) null);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         int bpc;
@@ -155,7 +155,7 @@ public final class LosslessFactory
         {
             bpc = 1;
             MemoryCacheImageOutputStream mcios = new MemoryCacheImageOutputStream(bos);
-            int width = alphaRaster.getSampleModel().getWidth();
+            int width = alphaRaster.getWidth();
             int p = 0;
             for (int pixel : pixels)
             {



Mime
View raw message