pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1188316 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDPixelMap.java
Date Mon, 24 Oct 2011 19:24:54 GMT
Author: lehmi
Date: Mon Oct 24 19:24:54 2011
New Revision: 1188316

URL: http://svn.apache.org/viewvc?rev=1188316&view=rev
Log:
PDFBOX-1146: use the alternative eval method introduced in revision 1188298

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDPixelMap.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDPixelMap.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDPixelMap.java?rev=1188316&r1=1188315&r2=1188316&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDPixelMap.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDPixelMap.java
Mon Oct 24 19:24:54 2011
@@ -35,9 +35,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.cos.COSInteger;
 import org.apache.pdfbox.cos.COSName;
-import org.apache.pdfbox.cos.COSNumber;
 import org.apache.pdfbox.pdmodel.common.PDStream;
 import org.apache.pdfbox.pdmodel.common.function.PDFunction;
 
@@ -219,8 +217,7 @@ public class PDPixelMap extends PDXObjec
                 // destination array
                 byte[] mappedData = new byte[width*height*numberOfComponents];
                 int rowLength = width*numberOfComponents;
-                COSArray input = new COSArray();
-                input.add(COSInteger.ZERO);
+                float[] input = new float[1];
                 for ( int i = 0; i < height; i++ )
                 {
                     int rowOffset = i * rowLength; 
@@ -230,18 +227,18 @@ public class PDPixelMap extends PDXObjec
                         int value = (array[ i * width + j ] + 256) % 256;
                         if (invert)
                         {
-                            input.set(0, 1-(value / maxValue) );
+                            input[0] = 1-(value / maxValue) ;
                         }
                         else
                         {
-                            input.set(0, value / maxValue);
+                            input[0] =  value / maxValue;
                         }
-                        COSArray mappedColor = tintTransformFunc.eval(input);
+                        float[] mappedColor = tintTransformFunc.eval(input);
                         int columnOffset = j * numberOfComponents;
                         for ( int k = 0; k < numberOfComponents; k++ ) 
                         {
                             // redo scaling for every single color value 
-                            float mappedValue = ((COSNumber)mappedColor.get(k)).floatValue();
+                            float mappedValue = mappedColor[k];
                             mappedData[ rowOffset + columnOffset + k] = (byte)(mappedValue
* maxValue);
                         }
                     }



Mime
View raw message