commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1293773 - /commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/gif/GifImageParser.java
Date Sun, 26 Feb 2012 08:28:37 GMT
Author: damjan
Date: Sun Feb 26 08:28:36 2012
New Revision: 1293773

URL: http://svn.apache.org/viewvc?rev=1293773&view=rev
Log:
Use ImageBuilder for GIF files.


Modified:
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/gif/GifImageParser.java

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/gif/GifImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/gif/GifImageParser.java?rev=1293773&r1=1293772&r2=1293773&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/gif/GifImageParser.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/gif/GifImageParser.java
Sun Feb 26 08:28:36 2012
@@ -39,6 +39,7 @@ import org.apache.commons.sanselan.Image
 import org.apache.commons.sanselan.ImageWriteException;
 import org.apache.commons.sanselan.common.BinaryOutputStream;
 import org.apache.commons.sanselan.common.IImageMetadata;
+import org.apache.commons.sanselan.common.ImageBuilder;
 import org.apache.commons.sanselan.common.bytesource.ByteSource;
 import org.apache.commons.sanselan.common.mylzw.MyLzwCompressor;
 import org.apache.commons.sanselan.common.mylzw.MyLzwDecompressor;
@@ -732,8 +733,7 @@ public class GifImageParser extends Imag
         if (gce != null && gce.transparency)
             hasAlpha = true;
 
-        BufferedImage result = getBufferedImageFactory(params)
-                .getColorBufferedImage(width, height, hasAlpha);
+        ImageBuilder imageBuilder = new ImageBuilder(width, height, hasAlpha);
 
         {
             int colorTable[];
@@ -755,8 +755,6 @@ public class GifImageParser extends Imag
             int rowsInPass3 = (height + 1) / 4;
             int rowsInPass4 = (height) / 2;
 
-            DataBuffer db = result.getRaster().getDataBuffer();
-
             for (int row = 0; row < height; row++)
             {
                 int y;
@@ -797,13 +795,13 @@ public class GifImageParser extends Imag
                     if (transparentIndex == index)
                         rgb = 0x00;
 
-                    db.setElem(y * width + x, rgb);
+                    imageBuilder.setRGB(x, y, rgb);
                 }
 
             }
         }
 
-        return result;
+        return imageBuilder.getBufferedImage();
 
     }
 



Mime
View raw message