pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1579073 - in /pdfbox/trunk/pdfbox/src: main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java
Date Tue, 18 Mar 2014 22:15:27 GMT
Author: tilman
Date: Tue Mar 18 22:15:27 2014
New Revision: 1579073

URL: http://svn.apache.org/r1579073
Log:
PDFBOX-1990: improve names as suggested by John Hewson

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.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=1579073&r1=1579072&r2=1579073&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
Tue Mar 18 22:15:27 2014
@@ -29,7 +29,7 @@ import org.apache.pdfbox.pdmodel.graphic
 
 /**
  * Factory for creating a PDImageXObject containing a lossless compressed image.
- * 
+ *
  * @author Tilman Hausherr
  */
 public class LosslessFactory
@@ -42,22 +42,22 @@ public class LosslessFactory
      * @return a new Image XObject
      * @throws IOException if something goes wrong
      */
-    public static PDImageXObject createLosslessFromImage(PDDocument document, BufferedImage
bim)
+    public static PDImageXObject createFromImage(PDDocument document, BufferedImage image)
             throws IOException
     {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
 
         //TODO use bit writing, indexed, etc
-        int h = bim.getHeight();
-        int w = bim.getWidth();
+        int h = image.getHeight();
+        int w = image.getWidth();
         for (int y = 0; y < h; ++y)
         {
             for (int x = 0; x < w; ++x)
             {
-                Color co = new Color(bim.getRGB(x, y));
-                bos.write(co.getRed());
-                bos.write(co.getGreen());
-                bos.write(co.getBlue());
+                Color color = new Color(image.getRGB(x, y));
+                bos.write(color.getRed());
+                bos.write(color.getGreen());
+                bos.write(color.getBlue());
             }
         }
 
@@ -74,8 +74,8 @@ public class LosslessFactory
         dict.setItem(COSName.FILTER, COSName.FLATE_DECODE);
         pdImage.setColorSpace(PDDeviceRGB.INSTANCE);  //TODO from image
         pdImage.setBitsPerComponent(8); //TODO other sizes
-        pdImage.setHeight(bim.getHeight());
-        pdImage.setWidth(bim.getWidth());
+        pdImage.setHeight(image.getHeight());
+        pdImage.setWidth(image.getWidth());
         return pdImage;
     }
 

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java?rev=1579073&r1=1579072&r2=1579073&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java
Tue Mar 18 22:15:27 2014
@@ -30,14 +30,14 @@ import org.apache.pdfbox.util.ImageIOUti
 public class LosslessFactoryTest extends TestCase
 {
     /**
-     * Tests LosslessFactoryTest#createLosslessFromImage(PDDocument document,
+     * Tests LosslessFactoryTest#createFromImage(PDDocument document,
      * BufferedImage image)
      */
     public void testCreateLosslessFromImage() throws IOException
     {
         PDDocument document = new PDDocument();
         BufferedImage image = ImageIO.read(JPEGFactoryTest.class.getResourceAsStream("png.png"));
-        PDImageXObject ximage = LosslessFactory.createLosslessFromImage(document, image);
+        PDImageXObject ximage = LosslessFactory.createFromImage(document, image);
         assertNotNull(ximage);
         assertNotNull(ximage.getCOSStream());
         assertTrue(ximage.getCOSStream().getFilteredLength() > 0);



Mime
View raw message