commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1293543 - in /commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan: common/ formats/tiff/ formats/tiff/datareaders/ formats/tiff/photometricinterpreters/ util/
Date Sat, 25 Feb 2012 07:57:48 GMT
Author: damjan
Date: Sat Feb 25 07:57:48 2012
New Revision: 1293543

URL: http://svn.apache.org/viewvc?rev=1293543&view=rev
Log:
Introduced an ImageBuilder helper class, that provides an efficient
setRGB() method. Used it within TIFF: the change reduced the time
taken to load a 20 megapixel file by about 33%, and reduced
the total time taken for the test phase of "mvn package" by 3-4%.
This work is largely based on the patch by Gary Lucas in SANSELAN-56.

Also commented out Debug.purgeMemory() - this method which
sleeps and calls System.gc() should be unnecessary on modern
JVMs, and with it commented out, the time taken for "mvn package"
goes from 1:42 to only 0:44.

Submitted by: Gary Lucas <gwlucas at sonalysts dot com>
Jira issue key: SANSELAN-56


Added:
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/ImageBuilder.java
  (with props)
Modified:
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReader.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderTiled.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCmyk.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterPalette.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterRgb.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/util/Debug.java

Added: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/ImageBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/ImageBuilder.java?rev=1293543&view=auto
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/ImageBuilder.java
(added)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/ImageBuilder.java
Sat Feb 25 07:57:48 2012
@@ -0,0 +1,50 @@
+package org.apache.commons.sanselan.common;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DataBufferInt;
+import java.awt.image.DirectColorModel;
+import java.awt.image.WritableRaster;
+import java.util.Properties;
+
+public class ImageBuilder {
+    private int[] data;
+    private int width;
+    private int height;
+    private boolean hasAlpha;
+    
+    public ImageBuilder(int width, int height, boolean hasAlpha) {
+        data = new int[width * height];
+        this.width = width;
+        this.height = height;
+        this.hasAlpha = hasAlpha;
+    }
+    
+    public void setRGB(int x, int y, int argb) {
+        final int rowOffset = y * width;
+        data[rowOffset + x] = argb;
+    }
+    
+    public BufferedImage getBufferedImage() {
+        ColorModel colorModel;
+        WritableRaster raster;
+        DataBufferInt buffer = new DataBufferInt(data, width * height);
+        if (hasAlpha) {
+            colorModel = new DirectColorModel(32,
+                    0x00ff0000,
+                    0x0000ff00,
+                    0x000000ff,
+                    0xff000000);
+            raster = WritableRaster.createPackedRaster(buffer, width, height, width,
+                    new int[] { 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }, null);
+        } else {
+            colorModel = new DirectColorModel(24,
+                    0x00ff0000,
+                    0x0000ff00,
+                    0x000000ff);
+            raster = WritableRaster.createPackedRaster(buffer, width, height, width,
+                    new int[] { 0x00ff0000, 0x0000ff00, 0x000000ff }, null);
+        }
+        return new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), new
Properties());
+    }
+}

Propchange: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/ImageBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
Sat Feb 25 07:57:48 2012
@@ -34,6 +34,7 @@ import org.apache.commons.sanselan.Image
 import org.apache.commons.sanselan.ImageReadException;
 import org.apache.commons.sanselan.ImageWriteException;
 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.formats.tiff.TiffDirectory.ImageDataElement;
 import org.apache.commons.sanselan.formats.tiff.constants.ExifTagConstants;
@@ -517,8 +518,7 @@ public class TiffImageParser extends Ima
                     + bitsPerSample.length + ")");
 
         boolean hasAlpha = false;
-        BufferedImage result = getBufferedImageFactory(params)
-                .getColorBufferedImage(width, height, hasAlpha);
+        ImageBuilder imageBuilder = new ImageBuilder(width, height, hasAlpha);
 
         PhotometricInterpreter photometricInterpreter = getPhotometricInterpreter(
                 directory, photometricInterpretation, bitsPerPixel,
@@ -530,11 +530,11 @@ public class TiffImageParser extends Ima
                 photometricInterpreter, bitsPerPixel, bitsPerSample, predictor,
                 samplesPerPixel, width, height, compression);
 
-        dataReader.readImageData(result);
+        dataReader.readImageData(imageBuilder);
 
         photometricInterpreter.dumpstats();
 
-        return result;
+        return imageBuilder.getBufferedImage();
     }
 
     private PhotometricInterpreter getPhotometricInterpreter(

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReader.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReader.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReader.java
Sat Feb 25 07:57:48 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.sanselan.formats.tiff.datareaders;
 
-import java.awt.image.BufferedImage;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -24,6 +23,7 @@ import java.io.InputStream;
 import org.apache.commons.sanselan.ImageReadException;
 import org.apache.commons.sanselan.common.BinaryConstants;
 import org.apache.commons.sanselan.common.BitInputStream;
+import org.apache.commons.sanselan.common.ImageBuilder;
 import org.apache.commons.sanselan.common.PackBits;
 import org.apache.commons.sanselan.common.itu_t4.T4AndT6Compression;
 import org.apache.commons.sanselan.common.mylzw.MyLzwDecompressor;
@@ -61,7 +61,7 @@ public abstract class DataReader impleme
     }
 
     //    public abstract void readImageData(BufferedImage bi, ByteSource byteSource)
-    public abstract void readImageData(BufferedImage bi)
+    public abstract void readImageData(ImageBuilder imageBuilder)
             throws ImageReadException, IOException;
 
     protected int[] getSamplesAsBytes(BitInputStream bis)

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java
Sat Feb 25 07:57:48 2012
@@ -16,12 +16,12 @@
  */
 package org.apache.commons.sanselan.formats.tiff.datareaders;
 
-import java.awt.image.BufferedImage;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
 import org.apache.commons.sanselan.ImageReadException;
 import org.apache.commons.sanselan.common.BitInputStream;
+import org.apache.commons.sanselan.common.ImageBuilder;
 import org.apache.commons.sanselan.formats.tiff.TiffDirectory;
 import org.apache.commons.sanselan.formats.tiff.TiffImageData;
 import org.apache.commons.sanselan.formats.tiff.photometricinterpreters.PhotometricInterpreter;
@@ -49,7 +49,7 @@ public final class DataReaderStrips exte
         this.imageData = imageData;
     }
 
-    private void interpretStrip(BufferedImage bi, byte bytes[],
+    private void interpretStrip(ImageBuilder imageBuilder, byte bytes[],
             int pixels_per_strip) throws ImageReadException, IOException
     {
         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
@@ -63,7 +63,7 @@ public final class DataReaderStrips exte
             {
                 samples = applyPredictor(samples, x);
 
-                photometricInterpreter.interpretPixel(bi, samples, x, y);
+                photometricInterpreter.interpretPixel(imageBuilder, samples, x, y);
             }
 
             x++;
@@ -80,7 +80,7 @@ public final class DataReaderStrips exte
 
     private int x = 0, y = 0;
 
-    public void readImageData(BufferedImage bi) throws ImageReadException,
+    public void readImageData(ImageBuilder imageBuilder) throws ImageReadException,
             IOException
     {
         for (int strip = 0; strip < imageData.strips.length; strip++)
@@ -96,7 +96,7 @@ public final class DataReaderStrips exte
             byte decompressed[] = decompress(compressed, compression,
                     (int)bytesPerStrip, width, (int)rowsInThisStrip);
 
-            interpretStrip(bi, decompressed, (int)pixelsPerStrip);
+            interpretStrip(imageBuilder, decompressed, (int)pixelsPerStrip);
 
         }
     }

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderTiled.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderTiled.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderTiled.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderTiled.java
Sat Feb 25 07:57:48 2012
@@ -16,12 +16,12 @@
  */
 package org.apache.commons.sanselan.formats.tiff.datareaders;
 
-import java.awt.image.BufferedImage;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
 import org.apache.commons.sanselan.ImageReadException;
 import org.apache.commons.sanselan.common.BitInputStream;
+import org.apache.commons.sanselan.common.ImageBuilder;
 import org.apache.commons.sanselan.formats.tiff.TiffDirectory;
 import org.apache.commons.sanselan.formats.tiff.TiffImageData;
 import org.apache.commons.sanselan.formats.tiff.photometricinterpreters.PhotometricInterpreter;
@@ -55,7 +55,7 @@ public final class DataReaderTiled exten
         this.imageData = imageData;
     }
 
-    private void interpretTile(BufferedImage bi, byte bytes[], int startX,
+    private void interpretTile(ImageBuilder imageBuilder, byte bytes[], int startX,
             int startY) throws ImageReadException, IOException
     {
         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
@@ -76,7 +76,7 @@ public final class DataReaderTiled exten
             if ((x < width) && (y < height))
             {
                 samples = applyPredictor(samples, x);
-                photometricInterpreter.interpretPixel(bi, samples, x, y);
+                photometricInterpreter.interpretPixel(imageBuilder, samples, x, y);
             }
 
             tileX++;
@@ -93,7 +93,7 @@ public final class DataReaderTiled exten
         }
     }
 
-    public void readImageData(BufferedImage bi) throws ImageReadException,
+    public void readImageData(ImageBuilder imageBuilder) throws ImageReadException,
             IOException
     {
         int bitsPerRow = tileWidth * bitsPerPixel;
@@ -108,7 +108,7 @@ public final class DataReaderTiled exten
             byte decompressed[] = decompress(compressed, compression,
                     bytesPerTile, tileWidth, tileLength);
 
-            interpretTile(bi, decompressed, x, y);
+            interpretTile(imageBuilder, decompressed, x, y);
 
             x += tileWidth;
             if (x >= width)

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreter.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
Sat Feb 25 07:57:48 2012
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.sanselan.formats.tiff.photometricinterpreters;
 
-import java.awt.image.BufferedImage;
 import java.io.IOException;
 
 import org.apache.commons.sanselan.ImageReadException;
+import org.apache.commons.sanselan.common.ImageBuilder;
 
 public abstract class PhotometricInterpreter
 {
@@ -39,7 +39,7 @@ public abstract class PhotometricInterpr
         this.height = height;
     }
 
-    public abstract void interpretPixel(BufferedImage bi, int samples[], int x,
+    public abstract void interpretPixel(ImageBuilder imageBuilder, int samples[], int x,
             int y) throws ImageReadException, IOException;
 
     /**

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java
Sat Feb 25 07:57:48 2012
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.sanselan.formats.tiff.photometricinterpreters;
 
-import java.awt.image.BufferedImage;
 import java.io.IOException;
 
 import org.apache.commons.sanselan.ImageReadException;
+import org.apache.commons.sanselan.common.ImageBuilder;
 
 public class PhotometricInterpreterBiLevel extends PhotometricInterpreter
 {
@@ -37,7 +37,7 @@ public class PhotometricInterpreterBiLev
         //        this.bitsPerPixel = fBitsPerPixel;
     }
 
-    public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
+    public void interpretPixel(ImageBuilder imageBuilder, int samples[], int x, int y)
             throws ImageReadException, IOException
     {
         int sample = samples[0];
@@ -52,6 +52,6 @@ public class PhotometricInterpreterBiLev
         int alpha = 0xff;
         int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue <<
0);
 
-        bi.setRGB(x, y, rgb);
+        imageBuilder.setRGB(x, y, rgb);
     }
 }
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java
Sat Feb 25 07:57:48 2012
@@ -16,11 +16,11 @@
  */
 package org.apache.commons.sanselan.formats.tiff.photometricinterpreters;
 
-import java.awt.image.BufferedImage;
 import java.io.IOException;
 
 import org.apache.commons.sanselan.ImageReadException;
 import org.apache.commons.sanselan.color.ColorConversions;
+import org.apache.commons.sanselan.common.ImageBuilder;
 
 public class PhotometricInterpreterCieLab extends PhotometricInterpreter
 {
@@ -34,7 +34,7 @@ public class PhotometricInterpreterCieLa
     {
     }
 
-    public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
+    public void interpretPixel(ImageBuilder imageBuilder, int samples[], int x, int y)
             throws ImageReadException, IOException
     {
         int cieL = samples[0];
@@ -42,7 +42,7 @@ public class PhotometricInterpreterCieLa
         int cieB = (byte) samples[2];
 
         int rgb = ColorConversions.convertCIELabtoARGBTest(cieL, cieA, cieB);
-        bi.setRGB(x, y, rgb);
+        imageBuilder.setRGB(x, y, rgb);
     }
 
 }
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCmyk.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCmyk.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCmyk.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCmyk.java
Sat Feb 25 07:57:48 2012
@@ -16,11 +16,11 @@
  */
 package org.apache.commons.sanselan.formats.tiff.photometricinterpreters;
 
-import java.awt.image.BufferedImage;
 import java.io.IOException;
 
 import org.apache.commons.sanselan.ImageReadException;
 import org.apache.commons.sanselan.color.ColorConversions;
+import org.apache.commons.sanselan.common.ImageBuilder;
 
 public class PhotometricInterpreterCmyk extends PhotometricInterpreter
 {
@@ -30,7 +30,7 @@ public class PhotometricInterpreterCmyk 
         super(fSamplesPerPixel, fBitsPerSample, Predictor, width, height);
     }
 
-    public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
+    public void interpretPixel(ImageBuilder imageBuilder, int samples[], int x, int y)
             throws ImageReadException, IOException
     {
 
@@ -40,7 +40,7 @@ public class PhotometricInterpreterCmyk 
         int sk = samples[3];
 
         int rgb = ColorConversions.convertCMYKtoRGB(sc, sm, sy, sk);
-        bi.setRGB(x, y, rgb);
+        imageBuilder.setRGB(x, y, rgb);
     }
 
 }
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java
Sat Feb 25 07:57:48 2012
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.sanselan.formats.tiff.photometricinterpreters;
 
-import java.awt.image.BufferedImage;
 import java.io.IOException;
 
 import org.apache.commons.sanselan.ImageReadException;
+import org.apache.commons.sanselan.common.ImageBuilder;
 
 public class PhotometricInterpreterLogLuv extends PhotometricInterpreter
 {
@@ -45,7 +45,7 @@ public class PhotometricInterpreterLogLu
 
     //        private float function_f(float value, )
 
-    public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
+    public void interpretPixel(ImageBuilder imageBuilder, int samples[], int x, int y)
             throws ImageReadException, IOException
     {
         float X, Y, Z;
@@ -148,7 +148,7 @@ public class PhotometricInterpreterLogLu
         blue = Math.min(255, Math.max(0, blue));
         int alpha = 0xff;
         int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue <<
0);
-        bi.setRGB(x, y, rgb);
+        imageBuilder.setRGB(x, y, rgb);
 
     }
 }
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterPalette.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterPalette.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterPalette.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterPalette.java
Sat Feb 25 07:57:48 2012
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.sanselan.formats.tiff.photometricinterpreters;
 
-import java.awt.image.BufferedImage;
 import java.io.IOException;
 
 import org.apache.commons.sanselan.ImageReadException;
+import org.apache.commons.sanselan.common.ImageBuilder;
 
 public class PhotometricInterpreterPalette extends PhotometricInterpreter
 {
@@ -34,7 +34,7 @@ public class PhotometricInterpreterPalet
         this.fColorMap = fColorMap;
     }
 
-    public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
+    public void interpretPixel(ImageBuilder imageBuilder, int samples[], int x, int y)
             throws ImageReadException, IOException
     {
         int fBitsPerPixel = bitsPerSample[0];
@@ -48,7 +48,7 @@ public class PhotometricInterpreterPalet
 
         int alpha = 0xff;
         int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue <<
0);
-        bi.setRGB(x, y, rgb);
+        imageBuilder.setRGB(x, y, rgb);
 
     }
 }
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterRgb.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterRgb.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterRgb.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterRgb.java
Sat Feb 25 07:57:48 2012
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.sanselan.formats.tiff.photometricinterpreters;
 
-import java.awt.image.BufferedImage;
 import java.io.IOException;
 
 import org.apache.commons.sanselan.ImageReadException;
+import org.apache.commons.sanselan.common.ImageBuilder;
 
 public class PhotometricInterpreterRgb extends PhotometricInterpreter
 {
@@ -29,7 +29,7 @@ public class PhotometricInterpreterRgb e
         super(fSamplesPerPixel, fBitsPerSample, Predictor, width, height);
     }
 
-    public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
+    public void interpretPixel(ImageBuilder imageBuilder, int samples[], int x, int y)
             throws ImageReadException, IOException
     {
         int red = samples[0];
@@ -38,7 +38,7 @@ public class PhotometricInterpreterRgb e
 
         int alpha = 0xff;
         int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue <<
0);
-        bi.setRGB(x, y, rgb);
+        imageBuilder.setRGB(x, y, rgb);
 
     }
 }
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
Sat Feb 25 07:57:48 2012
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.sanselan.formats.tiff.photometricinterpreters;
 
-import java.awt.image.BufferedImage;
 import java.io.IOException;
 
 import org.apache.commons.sanselan.ImageReadException;
+import org.apache.commons.sanselan.common.ImageBuilder;
 
 public class PhotometricInterpreterYCbCr extends PhotometricInterpreter
 {
@@ -65,7 +65,7 @@ public class PhotometricInterpreterYCbCr
         return rgb;
     }
 
-    public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
+    public void interpretPixel(ImageBuilder imageBuilder, int samples[], int x, int y)
             throws ImageReadException, IOException
     {
         int Y = samples[0];
@@ -81,7 +81,7 @@ public class PhotometricInterpreterYCbCr
 
         int alpha = 0xff;
         int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue <<
0);
-        bi.setRGB(x, y, rgb);
+        imageBuilder.setRGB(x, y, rgb);
 
     }
 }
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/util/Debug.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/util/Debug.java?rev=1293543&r1=1293542&r2=1293543&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/util/Debug.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/util/Debug.java
Sat Feb 25 07:57:48 2012
@@ -905,18 +905,18 @@ public final class Debug
 
     public static final void purgeMemory()
     {
-        try
-        {
-            //            Thread.sleep(50);
-            System.runFinalization();
-            Thread.sleep(50);
-            System.gc();
-            Thread.sleep(50);
-        }
-        catch (Throwable e)
-        {
-            Debug.debug(e);
-        }
+//        try
+//        {
+//            //            Thread.sleep(50);
+//            System.runFinalization();
+//            Thread.sleep(50);
+//            System.gc();
+//            Thread.sleep(50);
+//        }
+//        catch (Throwable e)
+//        {
+//            Debug.debug(e);
+//        }
     }
 
 }



Mime
View raw message