java.lang.Object
org.apache.batik.ext.awt.image.codec.ImageEncoderImpl
org.apache.batik.ext.awt.image.codec.tiff.TIFFImageEncoder
- All Implemented Interfaces:
- org.apache.batik.ext.awt.image.codec.ImageEncoder
- public class TIFFImageEncoder
- extends org.apache.batik.ext.awt.image.codec.ImageEncoderImpl
A baseline TIFF writer. The writer outputs TIFF images in either Bilevel,
Greyscale, Palette color or Full Color modes.
|
Method Summary |
private static int |
compressPackBits(byte[] data,
int numRows,
int bytesPerRow,
byte[] compData)
Performs PackBits compression on a tile of data. |
private static int |
deflate(java.util.zip.Deflater deflater,
byte[] inflated,
byte[] deflated)
|
void |
encode(java.awt.image.RenderedImage im)
Encodes a RenderedImage and writes the output to the
OutputStream associated with this ImageEncoder. |
private int |
encode(java.awt.image.RenderedImage im,
TIFFEncodeParam encodeParam,
int ifdOffset,
boolean isLast)
|
private int |
getDirectorySize(java.util.SortedSet fields)
Calculates the size of the IFD. |
private long |
getOffset(java.io.OutputStream out)
Returns the current offset in the supplied OutputStream. |
private static int |
getValueSize(TIFFField field)
Determine the number of bytes in the value portion of the field. |
private static void |
modifyEncodeParam(com.sun.image.codec.jpeg.JPEGEncodeParam src,
com.sun.image.codec.jpeg.JPEGEncodeParam dst,
int nbands)
|
private static int |
packBits(byte[] input,
int inOffset,
int inCount,
byte[] output,
int outOffset)
Performs PackBits compression for a single buffer of data. |
private void |
writeDirectory(int thisIFDOffset,
java.util.SortedSet fields,
int nextIFDOffset)
|
private void |
writeFileHeader()
|
private void |
writeLong(long l)
|
private void |
writeUnsignedShort(int s)
|
private void |
writeValues(TIFFField field)
|
private void |
writeValuesAsFourBytes(TIFFField field)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TIFF_UNSUPPORTED
private static final int TIFF_UNSUPPORTED
- See Also:
- Constant Field Values
TIFF_BILEVEL_WHITE_IS_ZERO
private static final int TIFF_BILEVEL_WHITE_IS_ZERO
- See Also:
- Constant Field Values
TIFF_BILEVEL_BLACK_IS_ZERO
private static final int TIFF_BILEVEL_BLACK_IS_ZERO
- See Also:
- Constant Field Values
TIFF_GRAY
private static final int TIFF_GRAY
- See Also:
- Constant Field Values
TIFF_PALETTE
private static final int TIFF_PALETTE
- See Also:
- Constant Field Values
TIFF_RGB
private static final int TIFF_RGB
- See Also:
- Constant Field Values
TIFF_CMYK
private static final int TIFF_CMYK
- See Also:
- Constant Field Values
TIFF_YCBCR
private static final int TIFF_YCBCR
- See Also:
- Constant Field Values
TIFF_CIELAB
private static final int TIFF_CIELAB
- See Also:
- Constant Field Values
TIFF_GENERIC
private static final int TIFF_GENERIC
- See Also:
- Constant Field Values
COMP_NONE
private static final int COMP_NONE
- See Also:
- Constant Field Values
COMP_JPEG_TTN2
private static final int COMP_JPEG_TTN2
- See Also:
- Constant Field Values
COMP_PACKBITS
private static final int COMP_PACKBITS
- See Also:
- Constant Field Values
COMP_DEFLATE
private static final int COMP_DEFLATE
- See Also:
- Constant Field Values
TIFF_JPEG_TABLES
private static final int TIFF_JPEG_TABLES
- See Also:
- Constant Field Values
TIFF_YCBCR_SUBSAMPLING
private static final int TIFF_YCBCR_SUBSAMPLING
- See Also:
- Constant Field Values
TIFF_YCBCR_POSITIONING
private static final int TIFF_YCBCR_POSITIONING
- See Also:
- Constant Field Values
TIFF_REF_BLACK_WHITE
private static final int TIFF_REF_BLACK_WHITE
- See Also:
- Constant Field Values
EXTRA_SAMPLE_UNSPECIFIED
private static final int EXTRA_SAMPLE_UNSPECIFIED
- See Also:
- Constant Field Values
EXTRA_SAMPLE_ASSOCIATED_ALPHA
private static final int EXTRA_SAMPLE_ASSOCIATED_ALPHA
- See Also:
- Constant Field Values
EXTRA_SAMPLE_UNASSOCIATED_ALPHA
private static final int EXTRA_SAMPLE_UNASSOCIATED_ALPHA
- See Also:
- Constant Field Values
DEFAULT_ROWS_PER_STRIP
private static final int DEFAULT_ROWS_PER_STRIP
- See Also:
- Constant Field Values
sizeOfType
private static final int[] sizeOfType
TIFFImageEncoder
public TIFFImageEncoder(java.io.OutputStream output,
org.apache.batik.ext.awt.image.codec.ImageEncodeParam param)
encode
public void encode(java.awt.image.RenderedImage im)
throws java.io.IOException
- Encodes a RenderedImage and writes the output to the
OutputStream associated with this ImageEncoder.
encode
private int encode(java.awt.image.RenderedImage im,
TIFFEncodeParam encodeParam,
int ifdOffset,
boolean isLast)
throws java.io.IOException
getDirectorySize
private int getDirectorySize(java.util.SortedSet fields)
- Calculates the size of the IFD.
writeFileHeader
private void writeFileHeader()
throws java.io.IOException
writeDirectory
private void writeDirectory(int thisIFDOffset,
java.util.SortedSet fields,
int nextIFDOffset)
throws java.io.IOException
getValueSize
private static final int getValueSize(TIFFField field)
- Determine the number of bytes in the value portion of the field.
writeValuesAsFourBytes
private void writeValuesAsFourBytes(TIFFField field)
throws java.io.IOException
writeValues
private void writeValues(TIFFField field)
throws java.io.IOException
writeUnsignedShort
private void writeUnsignedShort(int s)
throws java.io.IOException
writeLong
private void writeLong(long l)
throws java.io.IOException
getOffset
private long getOffset(java.io.OutputStream out)
throws java.io.IOException
- Returns the current offset in the supplied OutputStream.
This method should only be used if compressing data.
compressPackBits
private static int compressPackBits(byte[] data,
int numRows,
int bytesPerRow,
byte[] compData)
- Performs PackBits compression on a tile of data.
packBits
private static int packBits(byte[] input,
int inOffset,
int inCount,
byte[] output,
int outOffset)
- Performs PackBits compression for a single buffer of data.
This should be called for each row of each tile. The returned
value is the offset into the output buffer after compression.
deflate
private static int deflate(java.util.zip.Deflater deflater,
byte[] inflated,
byte[] deflated)
modifyEncodeParam
private static void modifyEncodeParam(com.sun.image.codec.jpeg.JPEGEncodeParam src,
com.sun.image.codec.jpeg.JPEGEncodeParam dst,
int nbands)