You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sanselan-commits@incubator.apache.org by cm...@apache.org on 2007/11/17 21:38:46 UTC
svn commit: r596006 [1/2] - in /incubator/sanselan/trunk/src:
main/java/org/apache/sanselan/ main/java/org/apache/sanselan/common/
main/java/org/apache/sanselan/common/byteSources/
main/java/org/apache/sanselan/formats/bmp/ main/java/org/apache/sansela...
Author: cmchen
Date: Sat Nov 17 13:38:44 2007
New Revision: 596006
URL: http://svn.apache.org/viewvc?rev=596006&view=rev
Log:
refactored "byte sources," improving performance around reading from input streams. Also moved "byte sources" into their own package.
Added first set of "replacement" unit tests.
A great deal of general code cleanup, mostly around naming conventions.
Added:
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSource.java (with props)
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceArray.java (with props)
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceFile.java (with props)
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceInputStream.java (with props)
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/util/CachingInputStream.java (with props)
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/util/IOUtils.java (with props)
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/SanselanTest.java (with props)
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/common/
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/common/byteSources/
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/common/byteSources/ByteSourceDataTest.java (with props)
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/common/byteSources/ByteSourceImageTest.java (with props)
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/common/byteSources/ByteSourceTest.java (with props)
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngWriteReadTest.java (with props)
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/test/
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/test/util/
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/test/util/FSTraversal.java (with props)
Removed:
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/ByteSource.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/ByteSourceArray.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/ByteSourceFile.java
Modified:
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ColorTools.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ImageInfo.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ImageParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/Sanselan.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/SanselanConstants.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/BmpHeaderInfo.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/BmpImageParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/ImageContents.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserBitFields.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserRgb.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserRle.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserSimple.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/gif/GifImageParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/ico/IcoImageParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/exifRewrite/ExifRewriter.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngImageParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngWriter.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediter.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterInterlaced.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterSimple.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/pnm/PNMImageParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PsdImageParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tga/TgaImageParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffDirectory.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffImageParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReader.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReaderStrips.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReaderTiled.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/icc/IccProfileParser.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/util/DebugInputStream.java
incubator/sanselan/trunk/src/main/java/org/apache/sanselan/util/DebugOutputStream.java
incubator/sanselan/trunk/src/test/java/org/apache/sanselan/AppTest.java
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ColorTools.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ColorTools.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ColorTools.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ColorTools.java Sat Nov 17 13:38:44 2007
@@ -30,9 +30,9 @@
import java.io.File;
import java.io.IOException;
-import org.apache.sanselan.common.ByteSource;
-import org.apache.sanselan.common.ByteSourceArray;
-import org.apache.sanselan.common.ByteSourceFile;
+import org.apache.sanselan.common.byteSources.ByteSource;
+import org.apache.sanselan.common.byteSources.ByteSourceArray;
+import org.apache.sanselan.common.byteSources.ByteSourceFile;
/**
* This class is a mess and needs to be cleaned up.
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ImageInfo.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ImageInfo.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ImageInfo.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ImageInfo.java Sat Nov 17 13:38:44 2007
@@ -140,7 +140,7 @@
*
* @see #getFormat()
*/
- public String FormatName()
+ public String getFormatName()
{
return formatName;
}
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ImageParser.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ImageParser.java Sat Nov 17 13:38:44 2007
@@ -19,7 +19,6 @@
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
@@ -28,12 +27,12 @@
import java.util.Vector;
import org.apache.sanselan.common.BinaryFileParser;
-import org.apache.sanselan.common.ByteSource;
-import org.apache.sanselan.common.ByteSourceArray;
-import org.apache.sanselan.common.ByteSourceFile;
import org.apache.sanselan.common.IBufferedImageFactory;
import org.apache.sanselan.common.IImageMetadata;
import org.apache.sanselan.common.SimpleBufferedImageFactory;
+import org.apache.sanselan.common.byteSources.ByteSource;
+import org.apache.sanselan.common.byteSources.ByteSourceArray;
+import org.apache.sanselan.common.byteSources.ByteSourceFile;
import org.apache.sanselan.formats.bmp.BmpImageParser;
import org.apache.sanselan.formats.gif.GifImageParser;
import org.apache.sanselan.formats.ico.IcoImageParser;
@@ -41,7 +40,6 @@
import org.apache.sanselan.formats.png.PngImageParser;
import org.apache.sanselan.formats.pnm.PNMImageParser;
import org.apache.sanselan.formats.psd.PsdImageParser;
-import org.apache.sanselan.formats.tga.TgaImageParser;
import org.apache.sanselan.formats.tiff.TiffImageParser;
import org.apache.sanselan.util.Debug;
@@ -57,7 +55,7 @@
new PngImageParser(), new BmpImageParser(),
new GifImageParser(), new PsdImageParser(),
new PNMImageParser(), new IcoImageParser(),
- new TgaImageParser(),
+// new TgaImageParser(),
};
return result;
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/Sanselan.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/Sanselan.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/Sanselan.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/Sanselan.java Sat Nov 17 13:38:44 2007
@@ -19,7 +19,6 @@
import java.awt.Dimension;
import java.awt.color.ICC_Profile;
import java.awt.image.BufferedImage;
-import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -31,10 +30,11 @@
import java.util.Map;
import java.util.Vector;
-import org.apache.sanselan.common.ByteSource;
-import org.apache.sanselan.common.ByteSourceArray;
-import org.apache.sanselan.common.ByteSourceFile;
import org.apache.sanselan.common.IImageMetadata;
+import org.apache.sanselan.common.byteSources.ByteSource;
+import org.apache.sanselan.common.byteSources.ByteSourceArray;
+import org.apache.sanselan.common.byteSources.ByteSourceFile;
+import org.apache.sanselan.common.byteSources.ByteSourceInputStream;
import org.apache.sanselan.icc.IccProfileInfo;
import org.apache.sanselan.icc.IccProfileParser;
import org.apache.sanselan.util.Debug;
@@ -65,6 +65,8 @@
*/
public static boolean hasImageFileExtension(File file)
{
+ if(!file.isFile())
+ return false;
return hasImageFileExtension(file.getName());
}
@@ -621,62 +623,29 @@
return imageParser.getAllBufferedImages(byteSource);
}
-// public static boolean extractImages(byte bytes[], File dstDir,
-// String dstRoot, ImageParser encoder) throws ImageReadException,
-// IOException, ImageWriteException
-// {
-// return extractImages(new ByteSourceArray(bytes), dstDir, dstRoot,
-// encoder);
-// }
-//
-// public static boolean extractImages(File file, File dstDir, String dstRoot,
-// ImageParser encoder) throws ImageReadException, IOException,
-// ImageWriteException
-// {
-// return extractImages(new ByteSourceFile(file), dstDir, dstRoot, encoder);
-// }
-//
-// public static boolean extractImages(ByteSource byteSource, File dstDir,
-// String dstRoot, ImageParser encoder) throws ImageReadException,
-// IOException, ImageWriteException
-// {
-// ImageParser imageParser = getImageParser(byteSource);
-//
-// return imageParser.extractImages(byteSource, dstDir, dstRoot, encoder);
-// }
-
- private static byte[] getInputStreamBytes(InputStream is)
- throws IOException
- {
- ByteArrayOutputStream os = null;
-
- try
- {
- os = new ByteArrayOutputStream(4096);
-
- is = new BufferedInputStream(is);
-
- int count;
- byte[] buffer = new byte[4096];
- while ((count = is.read(buffer, 0, 4096)) > 0)
- os.write(buffer, 0, count);
-
- os.flush();
-
- return os.toByteArray();
- }
- finally
- {
- try
- {
- if (os != null)
- os.close();
- }
- catch (IOException ioe)
- {
- }
- }
- }
+ // public static boolean extractImages(byte bytes[], File dstDir,
+ // String dstRoot, ImageParser encoder) throws ImageReadException,
+ // IOException, ImageWriteException
+ // {
+ // return extractImages(new ByteSourceArray(bytes), dstDir, dstRoot,
+ // encoder);
+ // }
+ //
+ // public static boolean extractImages(File file, File dstDir, String dstRoot,
+ // ImageParser encoder) throws ImageReadException, IOException,
+ // ImageWriteException
+ // {
+ // return extractImages(new ByteSourceFile(file), dstDir, dstRoot, encoder);
+ // }
+ //
+ // public static boolean extractImages(ByteSource byteSource, File dstDir,
+ // String dstRoot, ImageParser encoder) throws ImageReadException,
+ // IOException, ImageWriteException
+ // {
+ // ImageParser imageParser = getImageParser(byteSource);
+ //
+ // return imageParser.extractImages(byteSource, dstDir, dstRoot, encoder);
+ // }
/**
* Reads the first image from an InputStream as a BufferedImage.
@@ -716,8 +685,10 @@
public static BufferedImage getBufferedImage(InputStream is, Map params)
throws ImageReadException, IOException
{
- byte bytes[] = getInputStreamBytes(is);
- return getBufferedImage(new ByteSourceArray(bytes), params);
+ String filename = null;
+ if (params.containsKey(PARAM_KEY_FILENAME))
+ filename = (String) params.get(PARAM_KEY_FILENAME);
+ return getBufferedImage(new ByteSourceInputStream(is, filename), params);
}
/**
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/SanselanConstants.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/SanselanConstants.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/SanselanConstants.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/SanselanConstants.java Sat Nov 17 13:38:44 2007
@@ -28,6 +28,18 @@
public static final String PARAM_KEY_VERBOSE = "VERBOSE";
/**
+ * Parameter key. Used to hint the filename when reading from a byte array or InputStream.
+ * The filename hint can help disambiguate what file the image format.
+ * <p>
+ * Applies to read operations.
+ * <p>
+ * Valid values: filename as string
+ * <p>
+ * @see InputStream
+ */
+ public static final String PARAM_KEY_FILENAME = "FILENAME";
+
+ /**
* Parameter key. Used in write operations to indicate desired image format.
* <p>
* Valid values: Any format defined in ImageFormat, such as ImageFormat.IMAGE_FORMAT_PNG.
Added: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSource.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSource.java?rev=596006&view=auto
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSource.java (added)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSource.java Sat Nov 17 13:38:44 2007
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sanselan.common.byteSources;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.sanselan.common.BinaryFileFunctions;
+
+public abstract class ByteSource extends BinaryFileFunctions
+{
+ protected final String filename;
+
+ public ByteSource(final String filename)
+ {
+ this.filename = filename;
+ }
+
+ public final InputStream getInputStream(int start) throws IOException
+ {
+ InputStream is = getInputStream();
+
+ skipBytes(is, start);
+
+ return is;
+ }
+
+ public abstract InputStream getInputStream() throws IOException;
+
+ public abstract byte[] getBlock(int start, int length) throws IOException;
+
+ public abstract byte[] getAll() throws IOException;
+
+// public abstract long getLength();
+//
+// public byte[] getAll() throws IOException
+// {
+// return getBlock(0, (int) getLength());
+// }
+
+ public abstract String getDescription();
+
+ public final String getFilename()
+ {
+ return filename;
+ }
+}
\ No newline at end of file
Propchange: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceArray.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceArray.java?rev=596006&view=auto
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceArray.java (added)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceArray.java Sat Nov 17 13:38:44 2007
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sanselan.common.byteSources;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ByteSourceArray extends ByteSource
+{
+ private final byte bytes[];
+
+ public ByteSourceArray(String filename, byte bytes[])
+ {
+ super(filename);
+ this.bytes = bytes;
+ }
+
+ public ByteSourceArray(byte bytes[])
+ {
+ super(null);
+ this.bytes = bytes;
+ }
+
+ public InputStream getInputStream() //throws IOException
+ {
+ return new ByteArrayInputStream(bytes);
+ }
+
+ public byte[] getBlock(int start, int length) throws IOException
+ {
+ if (start + length > bytes.length)
+ throw new IOException("Could not read block.");
+
+ byte result[] = new byte[length];
+ System.arraycopy(bytes, start, result, 0, length);
+ return result;
+ }
+
+// public long getLength()
+// {
+// return bytes.length;
+// }
+
+ public byte[] getAll() throws IOException
+ {
+ return bytes;
+ }
+
+
+ public String getDescription()
+ {
+ return bytes.length + " byte array";
+ }
+
+}
\ No newline at end of file
Propchange: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceArray.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceFile.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceFile.java?rev=596006&view=auto
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceFile.java (added)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceFile.java Sat Nov 17 13:38:44 2007
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sanselan.common.byteSources;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.RandomAccessFile;
+
+import org.apache.sanselan.util.Debug;
+
+public class ByteSourceFile extends ByteSource
+{
+ private final File file;
+
+ public ByteSourceFile(File file)
+ {
+ super(file.getName());
+ this.file = file;
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ FileInputStream is = null;
+ BufferedInputStream bis = null;
+ is = new FileInputStream(file);
+ bis = new BufferedInputStream(is);
+
+ return bis;
+ }
+
+ public byte[] getBlock(int start, int length) throws IOException
+ {
+ RandomAccessFile raf = null;
+ try
+ {
+ raf = new RandomAccessFile(file, "r");
+
+ return getRAFBytes(raf, start, length,
+ "Could not read value from file");
+ }
+ finally
+ {
+ try
+ {
+ raf.close();
+ }
+ catch (Exception e)
+ {
+ Debug.debug(e);
+ }
+
+ }
+ }
+
+// public long getLength()
+// {
+// // System.out.println("file.length(): " + file.length());
+//
+// return file.length();
+// }
+
+ public byte[] getAll() throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ InputStream is = null;
+ try
+ {
+ is = new FileInputStream(file);
+ is = new BufferedInputStream(is);
+ byte buffer[] = new byte[1024];
+ int read;
+ while ((read = is.read(buffer)) > 0)
+ {
+ baos.write(buffer, 0, read);
+ }
+ return baos.toByteArray();
+ }
+ finally
+ {
+ try
+ {
+ if (null != is)
+ is.close();
+ }
+ catch (IOException e)
+ {
+ // Debug.d
+ }
+ }
+ }
+
+ public String getDescription()
+ {
+ return "File: '" + file.getAbsolutePath() + "'";
+ }
+
+}
\ No newline at end of file
Propchange: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceFile.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceInputStream.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceInputStream.java?rev=596006&view=auto
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceInputStream.java (added)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceInputStream.java Sat Nov 17 13:38:44 2007
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sanselan.common.byteSources;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.sanselan.util.Debug;
+
+public class ByteSourceInputStream extends ByteSource
+{
+ private final InputStream is;
+ private CacheBlock cacheHead = null;
+ private static final int BLOCK_SIZE = 1024;
+
+ public ByteSourceInputStream(InputStream is, String filename)
+ {
+ super(filename);
+ this.is = new BufferedInputStream(is);
+ }
+
+ private class CacheBlock
+ {
+ public final byte bytes[];
+ private CacheBlock next = null;
+ private boolean triedNext = false;
+
+ public CacheBlock(final byte[] bytes)
+ {
+ this.bytes = bytes;
+ }
+
+ public CacheBlock getNext() throws IOException
+ {
+ if (null != next)
+ return next;
+ if (triedNext)
+ return null;
+ triedNext = true;
+ next = readBlock();
+ return next;
+ }
+
+ }
+
+ private byte readBuffer[] = null;
+
+ private CacheBlock readBlock() throws IOException
+ {
+ if (null == readBuffer)
+ readBuffer = new byte[BLOCK_SIZE];
+
+ int read = is.read(readBuffer);
+ if (read < 1)
+ return null;
+ else if (read < BLOCK_SIZE)
+ {
+ // return a copy.
+ byte result[] = new byte[read];
+ System.arraycopy(readBuffer, 0, result, 0, read);
+ return new CacheBlock(result);
+ }
+ else
+ {
+ // return current buffer.
+ byte result[] = readBuffer;
+ readBuffer = null;
+ return new CacheBlock(result);
+ }
+ }
+
+ private CacheBlock getFirstBlock() throws IOException
+ {
+ if (null == cacheHead)
+ cacheHead = readBlock();
+ return cacheHead;
+ }
+
+ private class CacheReadingInputStream extends InputStream
+ {
+ private CacheBlock block = null;
+ private boolean readFirst = false;
+ private int blockIndex = 0;
+
+ public int read() throws IOException
+ {
+ if (null == block)
+ {
+ if (readFirst)
+ return -1;
+ block = getFirstBlock();
+ readFirst = true;
+ }
+
+ if (block != null && blockIndex >= block.bytes.length)
+ {
+ block = block.getNext();
+ blockIndex = 0;
+ }
+
+ if (null == block)
+ return -1;
+
+ if (blockIndex >= block.bytes.length)
+ return -1;
+
+ return 0xff & block.bytes[blockIndex++];
+ }
+
+ public int read(byte b[], int off, int len) throws IOException
+ {
+ // first section copied verbatim from InputStream
+ if (b == null)
+ throw new NullPointerException();
+ else if ((off < 0) || (off > b.length) || (len < 0)
+ || ((off + len) > b.length) || ((off + len) < 0))
+ throw new IndexOutOfBoundsException();
+ else if (len == 0)
+ return 0;
+
+ // optimized block read
+
+ if (null == block)
+ {
+ if (readFirst)
+ return -1;
+ block = getFirstBlock();
+ readFirst = true;
+ }
+
+ if (block != null && blockIndex >= block.bytes.length)
+ {
+ block = block.getNext();
+ blockIndex = 0;
+ }
+
+ if (null == block)
+ return -1;
+
+ if (blockIndex >= block.bytes.length)
+ return -1;
+
+ int readSize = Math.min(len, block.bytes.length-blockIndex);
+ System.arraycopy(block.bytes, blockIndex, b, off, readSize);
+ blockIndex += readSize;
+ return readSize;
+ }
+
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ return new CacheReadingInputStream();
+ }
+
+ public byte[] getBlock(int start, int length) throws IOException
+ {
+ InputStream is = getInputStream();
+ is.skip(start);
+
+ byte bytes[] = new byte[length];
+ int total = 0;
+ while (true)
+ {
+ int read = is.read(bytes, total, bytes.length - total);
+ if (read < 1)
+ throw new IOException("Could not read block.");
+ total += read;
+ if (total >= length)
+ return bytes;
+ }
+ }
+
+ // public long getLength()
+ // {
+ // // System.out.println("file.length(): " + file.length());
+ //
+ // return file.length();
+ // }
+
+ public byte[] getAll() throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ CacheBlock block = getFirstBlock();
+ while (block != null)
+ {
+ baos.write(block.bytes);
+ block = block.getNext();
+ }
+ return baos.toByteArray();
+ }
+
+ public String getDescription()
+ {
+ return "Inputstream: '" + filename + "'";
+ }
+
+}
\ No newline at end of file
Propchange: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/byteSources/ByteSourceInputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/BmpHeaderInfo.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/BmpHeaderInfo.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/BmpHeaderInfo.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/BmpHeaderInfo.java Sat Nov 17 13:38:44 2007
@@ -24,24 +24,24 @@
// CP - OS/2 Color Pointer
// IC - OS/2 Icon
// PT - OS/2 Pointer
- public final byte Identifier1;
- public final byte Identifier2;
+ public final byte identifier1;
+ public final byte identifier2;
- public final int FileSize;
- public final int Reserved;
- public final int BitmapDataOffset;
+ public final int fileSize;
+ public final int reserved;
+ public final int bitmapDataOffset;
- public final int BitmapHeaderSize;
- public final int Width;
- public final int Height;
- public final int Planes;
- public final int BitsPerPixel;
- public final int Compression;
- public final int BitmapDataSize;
- public final int HResolution;
- public final int VResolution;
- public final int ColorsUsed;
- public final int ColorsImportant;
+ public final int bitmapHeaderSize;
+ public final int width;
+ public final int height;
+ public final int planes;
+ public final int bitsPerPixel;
+ public final int compression;
+ public final int bitmapDataSize;
+ public final int hResolution;
+ public final int vResolution;
+ public final int colorsUsed;
+ public final int colorsImportant;
public BmpHeaderInfo(byte Identifier1, byte Identifier2, int FileSize,
int Reserved, int BitmapDataOffset,
@@ -51,23 +51,23 @@
int HResolution, int VResolution, int ColorsUsed,
int ColorsImportant)
{
- this.Identifier1 = Identifier1;
- this.Identifier2 = Identifier2;
- this.FileSize = FileSize;
- this.Reserved = Reserved;
- this.BitmapDataOffset = BitmapDataOffset;
+ this.identifier1 = Identifier1;
+ this.identifier2 = Identifier2;
+ this.fileSize = FileSize;
+ this.reserved = Reserved;
+ this.bitmapDataOffset = BitmapDataOffset;
- this.BitmapHeaderSize = BitmapHeaderSize;
- this.Width = Width;
- this.Height = Height;
- this.Planes = Planes;
- this.BitsPerPixel = BitsPerPixel;
- this.Compression = Compression;
- this.BitmapDataSize = BitmapDataSize;
- this.HResolution = HResolution;
- this.VResolution = VResolution;
- this.ColorsUsed = ColorsUsed;
- this.ColorsImportant = ColorsImportant;
+ this.bitmapHeaderSize = BitmapHeaderSize;
+ this.width = Width;
+ this.height = Height;
+ this.planes = Planes;
+ this.bitsPerPixel = BitsPerPixel;
+ this.compression = Compression;
+ this.bitmapDataSize = BitmapDataSize;
+ this.hResolution = HResolution;
+ this.vResolution = VResolution;
+ this.colorsUsed = ColorsUsed;
+ this.colorsImportant = ColorsImportant;
}
}
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/BmpImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/BmpImageParser.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/BmpImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/BmpImageParser.java Sat Nov 17 13:38:44 2007
@@ -35,8 +35,8 @@
import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.ImageWriteException;
import org.apache.sanselan.common.BinaryOutputStream;
-import org.apache.sanselan.common.ByteSource;
import org.apache.sanselan.common.IImageMetadata;
+import org.apache.sanselan.common.byteSources.ByteSource;
import org.apache.sanselan.formats.bmp.pixelparsers.PixelParser;
import org.apache.sanselan.formats.bmp.pixelparsers.PixelParserBitFields;
import org.apache.sanselan.formats.bmp.pixelparsers.PixelParserRgb;
@@ -205,36 +205,31 @@
{
BmpHeaderInfo bhi = readBmpHeaderInfo(is, formatCompliance);
- int ColorTableSize = bhi.ColorsUsed;
- if (ColorTableSize == 0)
- // ColorTableSize = (1 << bhi.BitsPerPixel) -1;
- ColorTableSize = (1 << bhi.BitsPerPixel);
+ int colorTableSize = bhi.colorsUsed;
+ if (colorTableSize == 0)
+ colorTableSize = (1 << bhi.bitsPerPixel);
if (debug)
{
- this.debugNumber("ColorsUsed", bhi.ColorsUsed, 4);
- this.debugNumber("BitsPerPixel", bhi.BitsPerPixel, 4);
- this.debugNumber("ColorTableSize", ColorTableSize, 4);
- this.debugNumber("Compression", bhi.Compression, 4);
- }
- // int BytesPerPaletteEntry;
- int PaletteLength;
- // int BytesPerPixel;
- // BytesPerPixel = bhi.BitsPerPixel / 8;
- // if (BytesPerPixel == 3)
- // BytesPerPixel = 4;
- int RLESamplesPerByte = 0;
+ this.debugNumber("ColorsUsed", bhi.colorsUsed, 4);
+ this.debugNumber("BitsPerPixel", bhi.bitsPerPixel, 4);
+ this.debugNumber("ColorTableSize", colorTableSize, 4);
+ this.debugNumber("Compression", bhi.compression, 4);
+ }
+
+ int paletteLength;
+ int rleSamplesPerByte = 0;
boolean rle = false;
- switch (bhi.Compression)
+ switch (bhi.compression)
{
case BI_RGB :
if (debug)
System.out.println("Compression: BI_RGB");
- if (bhi.BitsPerPixel <= 8)
- PaletteLength = 4 * ColorTableSize;
+ if (bhi.bitsPerPixel <= 8)
+ paletteLength = 4 * colorTableSize;
else
- PaletteLength = 0;
+ paletteLength = 0;
// BytesPerPaletteEntry = 0;
// System.out.println("Compression: BI_RGBx2: " + bhi.BitsPerPixel);
// System.out.println("Compression: BI_RGBx2: " + (bhi.BitsPerPixel <= 16));
@@ -243,8 +238,8 @@
case BI_RLE4 :
if (debug)
System.out.println("Compression: BI_RLE4");
- PaletteLength = 4 * ColorTableSize;
- RLESamplesPerByte = 2;
+ paletteLength = 4 * colorTableSize;
+ rleSamplesPerByte = 2;
// ExtraBitsPerPixel = 4;
rle = true;
//// BytesPerPixel = 2;
@@ -254,8 +249,8 @@
case BI_RLE8 :
if (debug)
System.out.println("Compression: BI_RLE8");
- PaletteLength = 4 * ColorTableSize;
- RLESamplesPerByte = 1;
+ paletteLength = 4 * colorTableSize;
+ rleSamplesPerByte = 1;
// ExtraBitsPerPixel = 8;
rle = true;
// BytesPerPixel = 2;
@@ -265,32 +260,32 @@
case BI_BITFIELDS :
if (debug)
System.out.println("Compression: BI_BITFIELDS");
- PaletteLength = 3 * 4; // TODO: is this right? are the masks always LONGs?
+ paletteLength = 3 * 4; // TODO: is this right? are the masks always LONGs?
// BytesPerPixel = 2;
// BytesPerPaletteEntry = 4;
break;
default :
throw new ImageReadException("BMP: Unknown Compression: "
- + bhi.Compression);
+ + bhi.compression);
}
- byte ColorTable[] = null;
- if (PaletteLength > 0)
+ byte colorTable[] = null;
+ if (paletteLength > 0)
// if (bhi.Compression != BI_RGB)
- ColorTable = this.readByteArray("ColorTable", PaletteLength, is,
+ colorTable = this.readByteArray("ColorTable", paletteLength, is,
"Not a Valid BMP File");
if (debug)
{
- this.debugNumber("PaletteLength", PaletteLength, 4);
+ this.debugNumber("PaletteLength", paletteLength, 4);
System.out.println("ColorTable: "
- + ((ColorTable == null) ? "null" : "" + ColorTable.length));
+ + ((colorTable == null) ? "null" : "" + colorTable.length));
}
- int PixelCount = bhi.Width * bhi.Height;
+ int pixelCount = bhi.width * bhi.height;
- int ImageLineLength = ((((bhi.BitsPerPixel) * bhi.Width) + 7) / 8);
+ int imageLineLength = ((((bhi.bitsPerPixel) * bhi.width) + 7) / 8);
if (debug)
{
@@ -299,37 +294,37 @@
// this.debugNumber("Total Bit Per Line",
// ((ExtraBitsPerPixel + bhi.BitsPerPixel) * bhi.Width), 4);
// this.debugNumber("ExtraBitsPerPixel", ExtraBitsPerPixel, 4);
- this.debugNumber("bhi.Width", bhi.Width, 4);
- this.debugNumber("bhi.Height", bhi.Height, 4);
- this.debugNumber("ImageLineLength", ImageLineLength, 4);
+ this.debugNumber("bhi.Width", bhi.width, 4);
+ this.debugNumber("bhi.Height", bhi.height, 4);
+ this.debugNumber("ImageLineLength", imageLineLength, 4);
// this.debugNumber("ImageDataSize", ImageDataSize, 4);
- this.debugNumber("PixelCount", PixelCount, 4);
+ this.debugNumber("PixelCount", pixelCount, 4);
}
// int ImageLineLength = BytesPerPixel * bhi.Width;
- while ((ImageLineLength % 4) != 0)
- ImageLineLength++;
+ while ((imageLineLength % 4) != 0)
+ imageLineLength++;
final int header_size = 54;
- int expected_data_offset = header_size + PaletteLength;
+ int expected_data_offset = header_size + paletteLength;
if (debug)
{
- this.debugNumber("bhi.BitmapDataOffset", bhi.BitmapDataOffset, 4);
+ this.debugNumber("bhi.BitmapDataOffset", bhi.bitmapDataOffset, 4);
this.debugNumber("expected_data_offset", expected_data_offset, 4);
}
- int extra_bytes = bhi.BitmapDataOffset - expected_data_offset;
+ int extra_bytes = bhi.bitmapDataOffset - expected_data_offset;
if (extra_bytes < 0)
throw new ImageReadException("BMP: Strange BitmapDataOffset: "
- + bhi.BitmapDataOffset + " (expected: "
+ + bhi.bitmapDataOffset + " (expected: "
+ expected_data_offset + ", PaletteLength: "
- + PaletteLength + ", header_size: " + header_size + ")");
+ + paletteLength + ", header_size: " + header_size + ")");
else if (extra_bytes > 0)
// if(bhi.BiCtmapDataOffset>0)
//// byte ImageData[] =
this.readByteArray("BitmapDataOffset", extra_bytes, is,
"Not a Valid BMP File");
- int ImageDataSize = bhi.Height * ImageLineLength;
+ int ImageDataSize = bhi.height * imageLineLength;
if (debug)
{
@@ -338,7 +333,7 @@
byte ImageData[];
if (rle)
- ImageData = getRLEBytes(is, RLESamplesPerByte);
+ ImageData = getRLEBytes(is, rleSamplesPerByte);
else
ImageData = this.readByteArray("ImageData", ImageDataSize, is,
"Not a Valid BMP File");
@@ -349,27 +344,27 @@
}
PixelParser pixelParser;
- switch (bhi.Compression)
+ switch (bhi.compression)
{
case BI_RLE4 :
case BI_RLE8 :
- pixelParser = new PixelParserRle(bhi, ColorTable, ImageData);
+ pixelParser = new PixelParserRle(bhi, colorTable, ImageData);
break;
case BI_RGB :
- pixelParser = new PixelParserRgb(bhi, ColorTable, ImageData);
+ pixelParser = new PixelParserRgb(bhi, colorTable, ImageData);
break;
case BI_BITFIELDS :
- pixelParser = new PixelParserBitFields(bhi, ColorTable,
+ pixelParser = new PixelParserBitFields(bhi, colorTable,
ImageData);
break;
default :
throw new ImageReadException("BMP: Unknown Compression: "
- + bhi.Compression);
+ + bhi.compression);
}
- return new ImageContents(bhi, ColorTable, ImageData, pixelParser);
+ return new ImageContents(bhi, colorTable, ImageData, pixelParser);
}
private BmpHeaderInfo readBmpHeaderInfo(ByteSource byteSource)
@@ -422,7 +417,7 @@
if (bhi == null)
throw new ImageReadException("BMP: couldn't read header");
- return new Dimension(bhi.Width, bhi.Height);
+ return new Dimension(bhi.width, bhi.height);
}
@@ -470,39 +465,39 @@
throw new ImageReadException("Couldn't read BMP Data");
BmpHeaderInfo bhi = ic.bhi;
- byte ColorTable[] = ic.ColorTable;
+ byte colorTable[] = ic.colorTable;
// byte ImageData[] = ic.ImageData;
// BmpHeaderInfo bhi = readBmpHeaderInfo(byteSource);
if (bhi == null)
throw new ImageReadException("BMP: couldn't read header");
- int Height = bhi.Height;
- int Width = bhi.Width;
+ int Height = bhi.height;
+ int Width = bhi.width;
Vector Comments = new Vector();
// TODO: comments...
- int BitsPerPixel = bhi.BitsPerPixel;
- ImageFormat Format = ImageFormat.IMAGE_FORMAT_BMP;
- String FormatName = "BMP Windows Bitmap";
- String MimeType = "image/x-ms-bmp";
+ int bitsPerPixel = bhi.bitsPerPixel;
+ ImageFormat format = ImageFormat.IMAGE_FORMAT_BMP;
+ String fName = "BMP Windows Bitmap";
+ String mimeType = "image/x-ms-bmp";
// we ought to count images, but don't yet.
- int NumberOfImages = -1;
+ int numberOfImages = -1;
// not accurate ... only reflects first
boolean isProgressive = false;
// boolean isProgressive = (fPNGChunkIHDR.InterlaceMethod != 0);
//
// pixels per meter
- int PhysicalWidthDpi = (int) ((double) bhi.HResolution * 1000.0 / 2.54);
- float PhysicalWidthInch = (float) ((double) Width / (double) PhysicalWidthDpi);
- // int PhysicalHeightDpi = 72;
- int PhysicalHeightDpi = (int) ((double) bhi.VResolution * 1000.0 / 2.54);
- float PhysicalHeightInch = (float) ((double) Height / (double) PhysicalHeightDpi);
-
- String FormatDetails = "Bmp (" + (char) bhi.Identifier1
- + (char) bhi.Identifier2 + ": "
- + getBmpTypeDescription(bhi.Identifier1, bhi.Identifier2) + ")";
+ int physicalWidthDpi = (int) ((double) bhi.hResolution * 1000.0 / 2.54);
+ float physicalWidthInch = (float) ((double) Width / (double) physicalWidthDpi);
+ // int physicalHeightDpi = 72;
+ int physicalHeightDpi = (int) ((double) bhi.vResolution * 1000.0 / 2.54);
+ float physicalHeightInch = (float) ((double) Height / (double) physicalHeightDpi);
+
+ String formatDetails = "Bmp (" + (char) bhi.identifier1
+ + (char) bhi.identifier2 + ": "
+ + getBmpTypeDescription(bhi.identifier1, bhi.identifier2) + ")";
boolean isTransparent = false;
// if (gce != null)
@@ -511,20 +506,15 @@
// isTransparent = true;
// }
- boolean usesPalette = ColorTable != null;
+ boolean usesPalette = colorTable != null;
int ColorType = ImageInfo.COLOR_TYPE_RGB;
String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_RLE;
- ImageInfo result = new ImageInfo(FormatDetails, BitsPerPixel, Comments,
- Format, FormatName, Height, MimeType, NumberOfImages,
- PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
- PhysicalWidthInch, Width, isProgressive, isTransparent,
+ ImageInfo result = new ImageInfo(formatDetails, bitsPerPixel, Comments,
+ format, fName, Height, mimeType, numberOfImages,
+ physicalHeightDpi, physicalHeightInch, physicalWidthDpi,
+ physicalWidthInch, Width, isProgressive, isTransparent,
usesPalette, ColorType, compressionAlgorithm);
- //
- // ImageData result = new ImageData(FormatDetails, BitsPerPixel, Comments,
- // Format, FormatName, Height, MimeType, NumberOfImages,
- // PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
- // PhysicalWidthInch, Width, isProgressive);
return result;
}
@@ -534,31 +524,11 @@
{
pw.println("bmp.dumpImageFile");
- {
- ImageInfo fImageData = getImageInfo(byteSource);
- if (fImageData == null)
- return false;
-
- fImageData.toString(pw, "");
- }
- {
- // ImageContents ic = readImageContents(byteSource);
+ ImageInfo imageData = getImageInfo(byteSource);
+ if (imageData == null)
+ return false;
- // ImageContents blocks = readImage(byteSource, false);
- //
- // if (blocks == null)
- // return false;
- //
- // System.out.println("gif.blocks: " + blocks.blocks.size());
- // for (int i = 0; i < blocks.blocks.size(); i++)
- // {
- // GIFBlock fGIFBlock = (GIFBlock) blocks.blocks.get(i);
- // this.debugNumber("\t" + i + " ("
- // + fGIFBlock.getClass().getName() + ")",
- // fGIFBlock.block_code, 4);
- // }
- //
- }
+ imageData.toString(pw, "");
pw.println("");
@@ -586,11 +556,11 @@
throw new ImageReadException("Couldn't read BMP Data");
BmpHeaderInfo bhi = ic.bhi;
- byte ColorTable[] = ic.ColorTable;
- byte ImageData[] = ic.ImageData;
+ byte colorTable[] = ic.colorTable;
+ byte imageData[] = ic.imageData;
- int width = bhi.Width;
- int height = bhi.Height;
+ int width = bhi.width;
+ int height = bhi.height;
BufferedImage result = getBufferedImageFactory(params)
.getColorBufferedImage(width, height);
@@ -603,7 +573,7 @@
System.out.println("width*height*4: " + width * height * 4);
}
- PixelParser pixelParser = ic.fPixelParser;
+ PixelParser pixelParser = ic.pixelParser;
pixelParser.processImage(result);
@@ -632,11 +602,6 @@
SimplePalette palette = new PaletteFactory()
.makePaletteSimple(src, 256);
- // int palette[] = new PaletteFactory().makePaletteSimple(src, 256);
- // palette(src);
- // int color_count = countColors(src, 256);
-
- // System.out.println("color_count: " + color_count);
BMPWriter writer = null;
if (palette == null)
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/ImageContents.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/ImageContents.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/ImageContents.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/ImageContents.java Sat Nov 17 13:38:44 2007
@@ -21,17 +21,17 @@
class ImageContents
{
public final BmpHeaderInfo bhi;
- public final byte ColorTable[];
- public final byte ImageData[];
- public final PixelParser fPixelParser;
+ public final byte colorTable[];
+ public final byte imageData[];
+ public final PixelParser pixelParser;
public ImageContents(BmpHeaderInfo bhi, byte ColorTable[],
byte ImageData[], PixelParser fPixelParser)
{
this.bhi = bhi;
- this.ColorTable = ColorTable;
- this.ImageData = ImageData;
- this.fPixelParser = fPixelParser;
+ this.colorTable = ColorTable;
+ this.imageData = ImageData;
+ this.pixelParser = fPixelParser;
}
}
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserBitFields.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserBitFields.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserBitFields.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserBitFields.java Sat Nov 17 13:38:44 2007
@@ -79,29 +79,29 @@
{
int data;
- if (bhi.BitsPerPixel == 8)
+ if (bhi.bitsPerPixel == 8)
{
data = 0xff & imageData[bytecount + 0];
bytecount += 1;
}
- else if (bhi.BitsPerPixel == 24)
+ else if (bhi.bitsPerPixel == 24)
{
data = bfp.read3Bytes("Pixel", is, "BMP Image Data");
bytecount += 3;
}
- else if (bhi.BitsPerPixel == 32)
+ else if (bhi.bitsPerPixel == 32)
{
data = bfp.read4Bytes("Pixel", is, "BMP Image Data");
bytecount += 4;
}
- else if (bhi.BitsPerPixel == 16)
+ else if (bhi.bitsPerPixel == 16)
{
data = bfp.read2Bytes("Pixel", is, "BMP Image Data");
bytecount += 2;
}
else
throw new ImageReadException("Unknown BitsPerPixel: "
- + bhi.BitsPerPixel);
+ + bhi.bitsPerPixel);
int red = (redMask & data);
int green = (greenMask & data);
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserRgb.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserRgb.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserRgb.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserRgb.java Sat Nov 17 13:38:44 2007
@@ -40,15 +40,15 @@
{
pixel_count++;
- if ((bhi.BitsPerPixel == 1) // always grayscale?
- || (bhi.BitsPerPixel == 4)) // always grayscale?
+ if ((bhi.bitsPerPixel == 1) // always grayscale?
+ || (bhi.bitsPerPixel == 4)) // always grayscale?
{
- if (cached_bit_count < bhi.BitsPerPixel)
+ if (cached_bit_count < bhi.bitsPerPixel)
{
if (cached_bit_count != 0)
throw new ImageReadException("Unexpected leftover bits: "
- + cached_bit_count + "/" + bhi.BitsPerPixel);
+ + cached_bit_count + "/" + bhi.bitsPerPixel);
// cached_byte = 0;
@@ -62,16 +62,16 @@
// + (pixel_count - 1));
bytecount++;
}
- int cache_mask = (1 << bhi.BitsPerPixel) - 1;
- int sample = cache_mask & (cached_byte >> (8 - bhi.BitsPerPixel));
- cached_byte = 0xff & (cached_byte << bhi.BitsPerPixel);
- cached_bit_count -= bhi.BitsPerPixel;
+ int cache_mask = (1 << bhi.bitsPerPixel) - 1;
+ int sample = cache_mask & (cached_byte >> (8 - bhi.bitsPerPixel));
+ cached_byte = 0xff & (cached_byte << bhi.bitsPerPixel);
+ cached_bit_count -= bhi.bitsPerPixel;
int rgb = getColorTableRGB(sample);
return rgb;
}
- else if (bhi.BitsPerPixel == 8) // always grayscale?
+ else if (bhi.bitsPerPixel == 8) // always grayscale?
{
int sample = 0xff & imageData[bytecount + 0];
@@ -81,7 +81,7 @@
return rgb;
}
- else if (bhi.BitsPerPixel == 16)
+ else if (bhi.bitsPerPixel == 16)
{
int data = bfp.read2Bytes("Pixel", is, "BMP Image Data");
@@ -96,7 +96,7 @@
return rgb;
}
- else if (bhi.BitsPerPixel == 24)
+ else if (bhi.bitsPerPixel == 24)
{
int blue = 0xff & imageData[bytecount + 0];
int green = 0xff & imageData[bytecount + 1];
@@ -109,7 +109,7 @@
return rgb;
}
- else if (bhi.BitsPerPixel == 32)
+ else if (bhi.bitsPerPixel == 32)
{
int blue = 0xff & imageData[bytecount + 0];
int green = 0xff & imageData[bytecount + 1];
@@ -124,7 +124,7 @@
}
throw new ImageReadException("Unknown BitsPerPixel: "
- + bhi.BitsPerPixel);
+ + bhi.bitsPerPixel);
}
public void newline() throws ImageReadException, IOException
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserRle.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserRle.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserRle.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserRle.java Sat Nov 17 13:38:44 2007
@@ -35,26 +35,26 @@
private int getSamplesPerByte() throws ImageReadException, IOException
{
- if (bhi.BitsPerPixel == 8)
+ if (bhi.bitsPerPixel == 8)
return 1;
- else if (bhi.BitsPerPixel == 4)
+ else if (bhi.bitsPerPixel == 4)
return 2;
else
throw new ImageReadException("BMP RLE: bad BitsPerPixel: "
- + bhi.BitsPerPixel);
+ + bhi.bitsPerPixel);
}
private int[] convertDataToSamples(int data) throws ImageReadException,
IOException
{
int rgbs[];
- if (bhi.BitsPerPixel == 8)
+ if (bhi.bitsPerPixel == 8)
{
rgbs = new int[1];
rgbs[0] = getColorTableRGB(data);
// pixels_written = 1;
}
- else if (bhi.BitsPerPixel == 4)
+ else if (bhi.bitsPerPixel == 4)
{
rgbs = new int[2];
int sample1 = data >> 4;
@@ -65,7 +65,7 @@
}
else
throw new ImageReadException("BMP RLE: bad BitsPerPixel: "
- + bhi.BitsPerPixel);
+ + bhi.bitsPerPixel);
return rgbs;
}
@@ -85,7 +85,7 @@
// rgb = getNextRGB();
int rgb = rgbs[i % rgbs.length];
// bi.setRGB(x, y, rgb);
- db.setElem(y * bhi.Width + x, rgb);
+ db.setElem(y * bhi.width + x, rgb);
// bi.setRGB(x, y, 0xff00ff00);
}
else
@@ -106,8 +106,8 @@
DataBuffer db = bi.getRaster().getDataBuffer();
int count = 0;
- int width = bhi.Width;
- int height = bhi.Height;
+ int width = bhi.width;
+ int height = bhi.height;
int x = 0, y = height - 1;
// bfp.setDebug(true);
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserSimple.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserSimple.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserSimple.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserSimple.java Sat Nov 17 13:38:44 2007
@@ -40,14 +40,14 @@
{
DataBuffer db = bi.getRaster().getDataBuffer();
- for (int y = bhi.Height - 1; y >= 0; y--)
+ for (int y = bhi.height - 1; y >= 0; y--)
{
- for (int x = 0; x < bhi.Width; x++)
+ for (int x = 0; x < bhi.width; x++)
{
int rgb = 0xff000000;
rgb = getNextRGB();
- db.setElem(y * bhi.Width + x, rgb);
+ db.setElem(y * bhi.width + x, rgb);
}
newline();
}
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/gif/GifImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/gif/GifImageParser.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/gif/GifImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/gif/GifImageParser.java Sat Nov 17 13:38:44 2007
@@ -36,8 +36,8 @@
import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.ImageWriteException;
import org.apache.sanselan.common.BinaryOutputStream;
-import org.apache.sanselan.common.ByteSource;
import org.apache.sanselan.common.IImageMetadata;
+import org.apache.sanselan.common.byteSources.ByteSource;
import org.apache.sanselan.common.mylzw.MyLZWCompressor;
import org.apache.sanselan.common.mylzw.MyLZWDecompressor;
import org.apache.sanselan.palette.Palette;
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/ico/IcoImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/ico/IcoImageParser.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/ico/IcoImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/ico/IcoImageParser.java Sat Nov 17 13:38:44 2007
@@ -35,8 +35,8 @@
import org.apache.sanselan.ImageParser;
import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.ImageWriteException;
-import org.apache.sanselan.common.ByteSource;
import org.apache.sanselan.common.IImageMetadata;
+import org.apache.sanselan.common.byteSources.ByteSource;
import org.apache.sanselan.util.Debug;
public class IcoImageParser extends ImageParser
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageParser.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageParser.java Sat Nov 17 13:38:44 2007
@@ -31,8 +31,8 @@
import org.apache.sanselan.ImageInfo;
import org.apache.sanselan.ImageParser;
import org.apache.sanselan.ImageReadException;
-import org.apache.sanselan.common.ByteSource;
import org.apache.sanselan.common.IImageMetadata;
+import org.apache.sanselan.common.byteSources.ByteSource;
import org.apache.sanselan.formats.jpeg.segments.App13Segment;
import org.apache.sanselan.formats.jpeg.segments.App2Segment;
import org.apache.sanselan.formats.jpeg.segments.GenericSegment;
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/exifRewrite/ExifRewriter.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/exifRewrite/ExifRewriter.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/exifRewrite/ExifRewriter.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/exifRewrite/ExifRewriter.java Sat Nov 17 13:38:44 2007
@@ -26,7 +26,7 @@
import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.ImageWriteException;
import org.apache.sanselan.common.BinaryFileParser;
-import org.apache.sanselan.common.ByteSource;
+import org.apache.sanselan.common.byteSources.ByteSource;
import org.apache.sanselan.formats.jpeg.JpegConstants;
import org.apache.sanselan.formats.jpeg.JpegImageParser;
import org.apache.sanselan.formats.jpeg.segments.GenericSegment;
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngImageParser.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngImageParser.java Sat Nov 17 13:38:44 2007
@@ -40,9 +40,9 @@
import org.apache.sanselan.ImageParser;
import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.ImageWriteException;
-import org.apache.sanselan.common.ByteSource;
import org.apache.sanselan.common.IImageMetadata;
import org.apache.sanselan.common.ImageMetadata;
+import org.apache.sanselan.common.byteSources.ByteSource;
import org.apache.sanselan.formats.png.chunks.PNGChunk;
import org.apache.sanselan.formats.png.chunks.PNGChunkIDAT;
import org.apache.sanselan.formats.png.chunks.PNGChunkIHDR;
@@ -822,7 +822,12 @@
// cm = ColorModel.getRGBdefault();
//
+
int bitsPerPixel = bitsPerSample * samplesPerPixel;
+ Debug.debug("bitsPerSample", bitsPerSample);
+ Debug.debug("samplesPerPixel", samplesPerPixel);
+
+
//
// WritableRaster raster = cm.createCompatibleWritableRaster(width,
// height);
@@ -845,7 +850,8 @@
int bitsPerScanLine = bitsPerPixel * width;
- // Debug.debug("bitsPerScanLine", bitsPerScanLine);
+ Debug.debug("bitsPerScanLine", bitsPerScanLine);
+ Debug.debug("bitsPerPixel", bitsPerPixel);
ScanExpediter scanExpediter;
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngWriter.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngWriter.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngWriter.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngWriter.java Sat Nov 17 13:38:44 2007
@@ -20,6 +20,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.zip.DeflaterOutputStream;
@@ -117,19 +118,19 @@
public final int width;
public final int height;
public final byte bit_depth;
- public final byte colour_type;
+ public final byte colorType;
public final byte compression_method;
public final byte filter_method;
public final byte interlace_method;
public ImageHeader(int width, int height, byte bit_depth,
- byte colour_type, byte compression_method, byte filter_method,
+ byte colorType, byte compression_method, byte filter_method,
byte interlace_method)
{
this.width = width;
this.height = height;
this.bit_depth = bit_depth;
- this.colour_type = colour_type;
+ this.colorType = colorType;
this.compression_method = compression_method;
this.filter_method = filter_method;
this.interlace_method = interlace_method;
@@ -144,7 +145,7 @@
writeInt(baos, value.width);
writeInt(baos, value.height);
baos.write(0xff & value.bit_depth);
- baos.write(0xff & value.colour_type);
+ baos.write(0xff & value.colorType);
baos.write(0xff & value.compression_method);
baos.write(0xff & value.filter_method);
baos.write(0xff & value.interlace_method);
@@ -208,7 +209,7 @@
return result;
}
- private byte getBitDepth(final byte colour_type, Map params)
+ private byte getBitDepth(final byte colorType, Map params)
{
byte result = 8;
@@ -226,7 +227,7 @@
result = (byte) value;
default :
}
- switch (colour_type)
+ switch (colorType)
{
case COLOR_TYPE_GREYSCALE :
break;
@@ -286,11 +287,19 @@
if (params.containsKey(PARAM_KEY_VERBOSE))
params.remove(PARAM_KEY_VERBOSE);
+ Map rawParams = new HashMap(params);
+ if (params.containsKey(PARAM_KEY_PNG_FORCE_TRUE_COLOR))
+ params.remove(PARAM_KEY_PNG_FORCE_TRUE_COLOR);
+ if (params.containsKey(PARAM_KEY_PNG_FORCE_INDEXED_COLOR))
+ params.remove(PARAM_KEY_PNG_FORCE_INDEXED_COLOR);
+ if (params.containsKey(PARAM_KEY_PNG_BIT_DEPTH))
+ params.remove(PARAM_KEY_PNG_BIT_DEPTH);
if (params.size() > 0)
{
Object firstKey = params.keySet().iterator().next();
throw new ImageWriteException("Unknown parameter: " + firstKey);
}
+ params = rawParams;
int width = src.getWidth();
int height = src.getHeight();
@@ -327,7 +336,7 @@
else
colorType = getColourType(hasAlpha, isGrayscale);
if (verbose)
- Debug.debug("colour_type", colorType);
+ Debug.debug("colorType", colorType);
}
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediter.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediter.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediter.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediter.java Sat Nov 17 13:38:44 2007
@@ -30,6 +30,7 @@
import org.apache.sanselan.formats.png.scanlinefilters.ScanlineFilterSub;
import org.apache.sanselan.formats.png.scanlinefilters.ScanlineFilterUp;
import org.apache.sanselan.formats.transparencyfilters.TransparencyFilter;
+import org.apache.sanselan.util.Debug;
public abstract class ScanExpediter extends BinaryFileParser
{
@@ -38,21 +39,16 @@
protected final InputStream is;
protected final BufferedImage bi;
protected final int colorType;
- protected final int BitDepth;
+ protected final int bitDepth;
protected final int bytesPerPixel;
protected final int bitsPerPixel;
protected final PNGChunkPLTE fPNGChunkPLTE;
protected final GammaCorrection gammaCorrection;
protected final TransparencyFilter transparencyFilter;
- // protected final DataBuffer buffer ;
-
public ScanExpediter(int width, int height, InputStream is,
- BufferedImage bi, int color_type,
- int BitDepth,
- // int BytesPerPixel,
- int BitsPerPixel, PNGChunkPLTE fPNGChunkPLTE,
- GammaCorrection fGammaCorrection,
+ BufferedImage bi, int color_type, int bitDepth, int bitsPerPixel,
+ PNGChunkPLTE pngChunkPLTE, GammaCorrection gammaCorrection,
TransparencyFilter transparencyFilter)
{
@@ -61,13 +57,15 @@
this.is = is;
this.bi = bi;
this.colorType = color_type;
- this.BitDepth = BitDepth;
- this.bytesPerPixel = this.getBitsToBytesRoundingUp(BitsPerPixel);
- this.bitsPerPixel = BitsPerPixel;
- this.fPNGChunkPLTE = fPNGChunkPLTE;
- this.gammaCorrection = fGammaCorrection;
+ this.bitDepth = bitDepth;
+ this.bytesPerPixel = this.getBitsToBytesRoundingUp(bitsPerPixel);
+ this.bitsPerPixel = bitsPerPixel;
+ this.fPNGChunkPLTE = pngChunkPLTE;
+ this.gammaCorrection = gammaCorrection;
this.transparencyFilter = transparencyFilter;
+ Debug.debug("BitDepth", bitDepth);
+ Debug.debug("bitsPerPixel", bitsPerPixel);
// Debug.debug("colorType", colorType);
// buffer = bi.getRaster().getDataBuffer();
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterInterlaced.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterInterlaced.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterInterlaced.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterInterlaced.java Sat Nov 17 13:38:44 2007
@@ -102,7 +102,7 @@
prev = unfiltered;
BitParser fBitParser = new BitParser(unfiltered,
- bitsPerPixel, BitDepth);
+ bitsPerPixel, bitDepth);
while (x < width)
{
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterSimple.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterSimple.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterSimple.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterSimple.java Sat Nov 17 13:38:44 2007
@@ -23,34 +23,38 @@
import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.formats.png.chunks.PNGChunkPLTE;
import org.apache.sanselan.formats.transparencyfilters.TransparencyFilter;
+import org.apache.sanselan.util.Debug;
public class ScanExpediterSimple extends ScanExpediter
{
public ScanExpediterSimple(int width, int height, InputStream is,
- BufferedImage bi, int color_type, int BitDepth, int bits_per_pixel,
- PNGChunkPLTE fPNGChunkPLTE, GammaCorrection fGammaCorrection,
- TransparencyFilter fTransparencyFilter)
+ BufferedImage bi, int color_type, int BitDepth, int bitsPerPixel,
+ PNGChunkPLTE pngChunkPLTE, GammaCorrection gammaCorrection,
+ TransparencyFilter transparencyFilter)
{
- super(width, height, is, bi, color_type, BitDepth, bits_per_pixel,
- fPNGChunkPLTE, fGammaCorrection, fTransparencyFilter);
+ super(width, height, is, bi, color_type, BitDepth, bitsPerPixel,
+ pngChunkPLTE, gammaCorrection, transparencyFilter);
}
public void drive() throws ImageReadException, IOException
{
int bitsPerScanLine = bitsPerPixel * width;
- int pixel_bytes_per_scan_line = getBitsToBytesRoundingUp(bitsPerScanLine);
+ Debug.debug("bitsPerPixel", bitsPerPixel);
+ Debug.debug("bitsPerScanLine", bitsPerScanLine);
+ int pixelBytesPerScanLine = getBitsToBytesRoundingUp(bitsPerScanLine);
+ Debug.debug("pixelBytesPerScanLine", pixelBytesPerScanLine);
byte prev[] = null;
for (int y = 0; y < height; y++)
{
- byte unfiltered[] = getNextScanline(is, pixel_bytes_per_scan_line,
+ byte unfiltered[] = getNextScanline(is, pixelBytesPerScanLine,
prev, bytesPerPixel);
prev = unfiltered;
BitParser bitParser = new BitParser(unfiltered, bitsPerPixel,
- BitDepth);
+ bitDepth);
for (int x = 0; x < width; x++)
{
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/pnm/PNMImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/pnm/PNMImageParser.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/pnm/PNMImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/pnm/PNMImageParser.java Sat Nov 17 13:38:44 2007
@@ -32,8 +32,8 @@
import org.apache.sanselan.ImageParser;
import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.ImageWriteException;
-import org.apache.sanselan.common.ByteSource;
import org.apache.sanselan.common.IImageMetadata;
+import org.apache.sanselan.common.byteSources.ByteSource;
import org.apache.sanselan.util.Debug;
public class PNMImageParser extends ImageParser
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PsdImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PsdImageParser.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PsdImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PsdImageParser.java Sat Nov 17 13:38:44 2007
@@ -30,8 +30,8 @@
import org.apache.sanselan.ImageInfo;
import org.apache.sanselan.ImageParser;
import org.apache.sanselan.ImageReadException;
-import org.apache.sanselan.common.ByteSource;
import org.apache.sanselan.common.IImageMetadata;
+import org.apache.sanselan.common.byteSources.ByteSource;
import org.apache.sanselan.formats.psd.dataparsers.DataParser;
import org.apache.sanselan.formats.psd.dataparsers.DataParserBitmap;
import org.apache.sanselan.formats.psd.dataparsers.DataParserCMYK;
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tga/TgaImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tga/TgaImageParser.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tga/TgaImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tga/TgaImageParser.java Sat Nov 17 13:38:44 2007
@@ -1,249 +1,249 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sanselan.formats.tga;
-
-import java.awt.Dimension;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.util.Map;
-import java.util.Vector;
-
-import org.apache.sanselan.ImageFormat;
-import org.apache.sanselan.ImageInfo;
-import org.apache.sanselan.ImageParser;
-import org.apache.sanselan.ImageReadException;
-import org.apache.sanselan.common.ByteSource;
-import org.apache.sanselan.common.IImageMetadata;
-import org.apache.sanselan.util.Debug;
-
-/*
- * This class is just a placeholder. TGA format is not yet supported.
- */
-public class TgaImageParser extends ImageParser implements TgaConstants
-{
- public TgaImageParser()
- {
- this.setByteOrder(BYTE_ORDER_INTEL);
- setDebug(true);
- }
-
- public String getName()
- {
- return "Tga";
- }
-
- public String getDefaultExtension()
- {
- return DEFAULT_EXTENSION;
- }
-
- private static final String DEFAULT_EXTENSION = ".tga";
-
- private static final String ACCEPTED_EXTENSIONS[] = {
- ".tga", ".tpic",
- };
-
- protected String[] getAcceptedExtensions()
- {
- return ACCEPTED_EXTENSIONS;
- }
-
- protected ImageFormat[] getAcceptedTypes()
- {
- return new ImageFormat[]{
- ImageFormat.IMAGE_FORMAT_TGA, //
- };
- }
-
- public IImageMetadata getMetadata(ByteSource byteSource, Map params)
- throws ImageReadException, IOException
- {
- return null;
- }
-
- public byte[] getICCProfileBytes(ByteSource byteSource)
- throws ImageReadException, IOException
- {
- return null;
- }
-
- private static final int TGA_FILE_HEADER_LENGTH = 18;
-
- public Dimension getImageSize(ByteSource byteSource)
- throws ImageReadException, IOException
- {
- int length = (int) byteSource.getLength();
- if (length < TGA_FILE_HEADER_LENGTH)
- return null;
-
- InputStream is = byteSource.getInputStream();
-
- is.skip(12);
-
- int width = this.read2Bytes("image width", is, "image width");
- int height = this.read2Bytes("image height", is, "image height");
-
- return new Dimension(width, height);
- }
-
- private static final int TGA_FILE_FOOTER_LENGTH = 26;
- private static final String TGA_FILE_FOOTER_SIGNATURE = "TRUEVISION-XFILE";
-
- private final boolean isNewTGAFormat(ByteSource byteSource)
- throws ImageReadException, IOException
- {
- int length = (int) byteSource.getLength();
- if (length < TGA_FILE_FOOTER_LENGTH)
- return true;
-
- InputStream is = byteSource.getInputStream(length
- - TGA_FILE_FOOTER_LENGTH);
-
- byte bytes[] = this.readByteArray("tga_file_footer",
- TGA_FILE_FOOTER_LENGTH, is, "tga_file_footer");
-
- Debug.debug("bytes", bytes);
-
- Debug.debug("kTGA_FILE_FOOTER_SIGNATURE", TGA_FILE_FOOTER_SIGNATURE);
- Debug.debug("kTGA_FILE_FOOTER_SIGNATURE", TGA_FILE_FOOTER_SIGNATURE
- .length());
-
- return this.compareByteArrays(bytes, 8, TGA_FILE_FOOTER_SIGNATURE
- .getBytes(), 0, TGA_FILE_FOOTER_SIGNATURE.length());
- }
-
- private static final int TGA_IMAGE_TYPE_NO_IMAGE = 0;
- private static final int UNCOMPRESSED_COLOR_MAPPED = 1;
- private static final int UNCOMPRESSED_RGB = 2;
- private static final int UNCOMPRESSED_BLACK_AND_WHITE = 3;
- private static final int COMPRESSED_COLOR_MAPPED_RLE = 9;
- private static final int COMPRESSED_RGB_RLE = 10;
- private static final int COMPRESSED_BLACK_AND_WHITE = 11;
- private static final int COMPRESSED_COLOR_MAPPED_DATA_HUFFMAN_DELTA_RLE = 32;
- private static final int COMPRESSED_COLOR_MAPPED_DATA_RLE = 33;
-
- public ImageInfo getImageInfo(ByteSource byteSource)
- throws ImageReadException, IOException
- {
- int length = (int) byteSource.getLength();
- if (length < TGA_FILE_HEADER_LENGTH)
- return null;
-
- InputStream is = byteSource.getInputStream();
-
- int id_string_length = this.readByte("id_string_length", is,
- "id_string_length");
- int color_map_type = this.readByte("color_map_type", is,
- "color_map_type");
- int image_type = this.readByte("image_type", is, "image_type");
-
- int color_map_first_entry_index = this.read2Bytes(
- "color_map_first_entry_index", is,
- "color_map_first_entry_index");
- int color_map_length = this.read2Bytes("color_map_length", is,
- "color_map_length");
- int color_map_entry_size = this.readByte("color_map_entry_size", is,
- "color_map_entry_size");
-
- int origin_x = this.read2Bytes("origin_x", is, "origin_x");
- int origin_y = this.read2Bytes("origin_y", is, "origin_y");
-
- int width = this.read2Bytes("image width", is, "image width");
- int height = this.read2Bytes("image height", is, "image height");
-
- int pixel_depth = this.readByte("pixel_depth", is, "pixel_depth");
- int image_descriptor = this.readByte("image_descriptor", is,
- "image_descriptor");
- // charles
-
- switch (image_type)
- {
- case UNCOMPRESSED_COLOR_MAPPED :
- break;
- case UNCOMPRESSED_RGB :
- break;
- case UNCOMPRESSED_BLACK_AND_WHITE :
- break;
- case COMPRESSED_COLOR_MAPPED_RLE :
- break;
- case COMPRESSED_RGB_RLE :
- break;
- case COMPRESSED_BLACK_AND_WHITE :
- break;
- case COMPRESSED_COLOR_MAPPED_DATA_HUFFMAN_DELTA_RLE :
- break;
- case COMPRESSED_COLOR_MAPPED_DATA_RLE :
- break;
-
- default :
-
- }
- String FormatDetails;
- int BitsPerPixel;
- Vector Comments;
- ImageFormat Format = ImageFormat.IMAGE_FORMAT_TGA;
- String FormatName = Format.name;
- String MimeType = "image/tga";
- int NumberOfImages = 1; // charles could have thumbnail(s).
- int PhysicalHeightDpi;
- float PhysicalHeightInch;
- int PhysicalWidthDpi;
- float PhysicalWidthInch;
- boolean isProgressive = false;
- boolean isTransparent = pixel_depth > 24;
- boolean usesPalette;
- int ColorType;
-
- return null;
- // return new ImageInfo(FormatDetails, BitsPerPixel, Comments, Format,
- // FormatName, height, MimeType, NumberOfImages,
- // PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
- // PhysicalWidthInch, width, isProgressive, isTransparent,
- // usesPalette, ColorType);
-
- // boolean is_new_tga_format = isNewTGAFormat(byteSource);
- //
- // Debug.debug("is_new_tga_format", is_new_tga_format);
- }
-
- public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource)
- throws ImageReadException, IOException
- {
- return false;
- }
-
- public BufferedImage getBufferedImage(ByteSource byteSource, Map params)
- throws ImageReadException, IOException
- {
- return null;
- }
-
- // public void writeImage(BufferedImage src, OutputStream os, Map params)
- // throws ImageWriteException, IOException
- // {
- // return false;
- // }
-
- public boolean embedICCProfile(File src, File dst, byte profile[])
- {
- return false;
- }
-
-}
\ No newline at end of file
+///*
+// * Licensed to the Apache Software Foundation (ASF) under one or more
+// * contributor license agreements. See the NOTICE file distributed with
+// * this work for additional information regarding copyright ownership.
+// * The ASF licenses this file to You under the Apache License, Version 2.0
+// * (the "License"); you may not use this file except in compliance with
+// * the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing, software
+// * distributed under the License is distributed on an "AS IS" BASIS,
+// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// * See the License for the specific language governing permissions and
+// * limitations under the License.
+// */
+//package org.apache.sanselan.formats.tga;
+//
+//import java.awt.Dimension;
+//import java.awt.image.BufferedImage;
+//import java.io.File;
+//import java.io.IOException;
+//import java.io.InputStream;
+//import java.io.PrintWriter;
+//import java.util.Map;
+//import java.util.Vector;
+//
+//import org.apache.sanselan.ImageFormat;
+//import org.apache.sanselan.ImageInfo;
+//import org.apache.sanselan.ImageParser;
+//import org.apache.sanselan.ImageReadException;
+//import org.apache.sanselan.common.IImageMetadata;
+//import org.apache.sanselan.common.byteSources.ByteSource;
+//import org.apache.sanselan.util.Debug;
+//
+///*
+// * This class is just a placeholder. TGA format is not yet supported.
+// */
+//public class TgaImageParser extends ImageParser implements TgaConstants
+//{
+// public TgaImageParser()
+// {
+// this.setByteOrder(BYTE_ORDER_INTEL);
+// setDebug(true);
+// }
+//
+// public String getName()
+// {
+// return "Tga";
+// }
+//
+// public String getDefaultExtension()
+// {
+// return DEFAULT_EXTENSION;
+// }
+//
+// private static final String DEFAULT_EXTENSION = ".tga";
+//
+// private static final String ACCEPTED_EXTENSIONS[] = {
+// ".tga", ".tpic",
+// };
+//
+// protected String[] getAcceptedExtensions()
+// {
+// return ACCEPTED_EXTENSIONS;
+// }
+//
+// protected ImageFormat[] getAcceptedTypes()
+// {
+// return new ImageFormat[]{
+// ImageFormat.IMAGE_FORMAT_TGA, //
+// };
+// }
+//
+// public IImageMetadata getMetadata(ByteSource byteSource, Map params)
+// throws ImageReadException, IOException
+// {
+// return null;
+// }
+//
+// public byte[] getICCProfileBytes(ByteSource byteSource)
+// throws ImageReadException, IOException
+// {
+// return null;
+// }
+//
+// private static final int TGA_FILE_HEADER_LENGTH = 18;
+//
+// public Dimension getImageSize(ByteSource byteSource)
+// throws ImageReadException, IOException
+// {
+//// int length = (int) byteSource.getLength();
+//// if (length < TGA_FILE_HEADER_LENGTH)
+//// return null;
+//
+// InputStream is = byteSource.getInputStream();
+//
+// is.skip(12);
+//
+// int width = this.read2Bytes("image width", is, "image width");
+// int height = this.read2Bytes("image height", is, "image height");
+//
+// return new Dimension(width, height);
+// }
+//
+// private static final int TGA_FILE_FOOTER_LENGTH = 26;
+// private static final String TGA_FILE_FOOTER_SIGNATURE = "TRUEVISION-XFILE";
+//
+// private final boolean isNewTGAFormat(ByteSource byteSource)
+// throws ImageReadException, IOException
+// {
+// int length = (int) byteSource.getLength();
+// if (length < TGA_FILE_FOOTER_LENGTH)
+// return true;
+//
+// InputStream is = byteSource.getInputStream(length
+// - TGA_FILE_FOOTER_LENGTH);
+//
+// byte bytes[] = this.readByteArray("tga_file_footer",
+// TGA_FILE_FOOTER_LENGTH, is, "tga_file_footer");
+//
+// Debug.debug("bytes", bytes);
+//
+// Debug.debug("kTGA_FILE_FOOTER_SIGNATURE", TGA_FILE_FOOTER_SIGNATURE);
+// Debug.debug("kTGA_FILE_FOOTER_SIGNATURE", TGA_FILE_FOOTER_SIGNATURE
+// .length());
+//
+// return this.compareByteArrays(bytes, 8, TGA_FILE_FOOTER_SIGNATURE
+// .getBytes(), 0, TGA_FILE_FOOTER_SIGNATURE.length());
+// }
+//
+// private static final int TGA_IMAGE_TYPE_NO_IMAGE = 0;
+// private static final int UNCOMPRESSED_COLOR_MAPPED = 1;
+// private static final int UNCOMPRESSED_RGB = 2;
+// private static final int UNCOMPRESSED_BLACK_AND_WHITE = 3;
+// private static final int COMPRESSED_COLOR_MAPPED_RLE = 9;
+// private static final int COMPRESSED_RGB_RLE = 10;
+// private static final int COMPRESSED_BLACK_AND_WHITE = 11;
+// private static final int COMPRESSED_COLOR_MAPPED_DATA_HUFFMAN_DELTA_RLE = 32;
+// private static final int COMPRESSED_COLOR_MAPPED_DATA_RLE = 33;
+//
+// public ImageInfo getImageInfo(ByteSource byteSource)
+// throws ImageReadException, IOException
+// {
+//// int length = (int) byteSource.getLength();
+//// if (length < TGA_FILE_HEADER_LENGTH)
+//// return null;
+//
+// InputStream is = byteSource.getInputStream();
+//
+// int id_string_length = this.readByte("id_string_length", is,
+// "id_string_length");
+// int color_map_type = this.readByte("color_map_type", is,
+// "color_map_type");
+// int image_type = this.readByte("image_type", is, "image_type");
+//
+// int color_map_first_entry_index = this.read2Bytes(
+// "color_map_first_entry_index", is,
+// "color_map_first_entry_index");
+// int color_map_length = this.read2Bytes("color_map_length", is,
+// "color_map_length");
+// int color_map_entry_size = this.readByte("color_map_entry_size", is,
+// "color_map_entry_size");
+//
+// int origin_x = this.read2Bytes("origin_x", is, "origin_x");
+// int origin_y = this.read2Bytes("origin_y", is, "origin_y");
+//
+// int width = this.read2Bytes("image width", is, "image width");
+// int height = this.read2Bytes("image height", is, "image height");
+//
+// int pixel_depth = this.readByte("pixel_depth", is, "pixel_depth");
+// int image_descriptor = this.readByte("image_descriptor", is,
+// "image_descriptor");
+// // charles
+//
+// switch (image_type)
+// {
+// case UNCOMPRESSED_COLOR_MAPPED :
+// break;
+// case UNCOMPRESSED_RGB :
+// break;
+// case UNCOMPRESSED_BLACK_AND_WHITE :
+// break;
+// case COMPRESSED_COLOR_MAPPED_RLE :
+// break;
+// case COMPRESSED_RGB_RLE :
+// break;
+// case COMPRESSED_BLACK_AND_WHITE :
+// break;
+// case COMPRESSED_COLOR_MAPPED_DATA_HUFFMAN_DELTA_RLE :
+// break;
+// case COMPRESSED_COLOR_MAPPED_DATA_RLE :
+// break;
+//
+// default :
+//
+// }
+// String FormatDetails;
+// int BitsPerPixel;
+// Vector Comments;
+// ImageFormat Format = ImageFormat.IMAGE_FORMAT_TGA;
+// String FormatName = Format.name;
+// String MimeType = "image/tga";
+// int NumberOfImages = 1; // charles could have thumbnail(s).
+// int PhysicalHeightDpi;
+// float PhysicalHeightInch;
+// int PhysicalWidthDpi;
+// float PhysicalWidthInch;
+// boolean isProgressive = false;
+// boolean isTransparent = pixel_depth > 24;
+// boolean usesPalette;
+// int ColorType;
+//
+// return null;
+// // return new ImageInfo(FormatDetails, BitsPerPixel, Comments, Format,
+// // FormatName, height, MimeType, NumberOfImages,
+// // PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
+// // PhysicalWidthInch, width, isProgressive, isTransparent,
+// // usesPalette, ColorType);
+//
+// // boolean is_new_tga_format = isNewTGAFormat(byteSource);
+// //
+// // Debug.debug("is_new_tga_format", is_new_tga_format);
+// }
+//
+// public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource)
+// throws ImageReadException, IOException
+// {
+// return false;
+// }
+//
+// public BufferedImage getBufferedImage(ByteSource byteSource, Map params)
+// throws ImageReadException, IOException
+// {
+// return null;
+// }
+//
+// // public void writeImage(BufferedImage src, OutputStream os, Map params)
+// // throws ImageWriteException, IOException
+// // {
+// // return false;
+// // }
+//
+// public boolean embedICCProfile(File src, File dst, byte profile[])
+// {
+// return false;
+// }
+//
+//}
\ No newline at end of file
Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffDirectory.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffDirectory.java?rev=596006&r1=596005&r2=596006&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffDirectory.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffDirectory.java Sat Nov 17 13:38:44 2007
@@ -20,7 +20,7 @@
import java.util.Vector;
import org.apache.sanselan.ImageReadException;
-import org.apache.sanselan.common.ByteSource;
+import org.apache.sanselan.common.byteSources.ByteSource;
public class TiffDirectory extends TiffElement implements TiffConstants
//extends BinaryFileFunctions