Class TIFFImage
- java.lang.Object
-
- org.apache.xmlgraphics.image.rendered.AbstractRed
-
- org.apache.xmlgraphics.image.codec.tiff.TIFFImage
-
- All Implemented Interfaces:
java.awt.image.RenderedImage
,CachableRed
public class TIFFImage extends AbstractRed
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
chromaSubH
(package private) int
chromaSubV
(package private) char[]
colormap
static int
COMP_DEFLATE
static int
COMP_FAX_G3_1D
static int
COMP_FAX_G3_2D
static int
COMP_FAX_G4_2D
static int
COMP_JPEG_OLD
static int
COMP_JPEG_TTN2
static int
COMP_LZW
static int
COMP_NONE
static int
COMP_PACKBITS
(package private) int
compression
(package private) int
dataType
(package private) boolean
decodePaletteAsShorts
private TIFFFaxDecoder
decoder
(package private) int
fillOrder
(package private) int
imageType
(package private) java.util.zip.Inflater
inflater
(package private) boolean
isBigEndian
(package private) boolean
isWhiteZero
private TIFFLZWDecoder
lzwDecoder
(package private) int
numBands
(package private) byte[]
palette
(package private) int
predictor
(package private) int
sampleSize
(package private) SeekableStream
stream
private static int
TIFF_JPEG_TABLES
private static int
TIFF_YCBCR_SUBSAMPLING
(package private) long
tiffT4Options
(package private) long
tiffT6Options
(package private) long[]
tileByteCounts
(package private) boolean
tiled
(package private) long[]
tileOffsets
(package private) int
tileSize
(package private) int
tilesX
(package private) int
tilesY
private static int
TYPE_BILEVEL
private static int
TYPE_GENERIC
private static int
TYPE_GRAY
private static int
TYPE_GRAY_4BIT
private static int
TYPE_GRAY_ALPHA
private static int
TYPE_PALETTE
private static int
TYPE_RGB
private static int
TYPE_RGB_ALPHA
private static int
TYPE_UNSUPPORTED
private static int
TYPE_YCBCR_SUB
-
Fields inherited from class org.apache.xmlgraphics.image.rendered.AbstractRed
bounds, cm, minTileX, minTileY, numXTiles, numYTiles, props, sm, srcs, tileGridXOff, tileGridYOff, tileHeight, tileWidth
-
-
Constructor Summary
Constructors Constructor Description TIFFImage(SeekableStream stream, TIFFDecodeParam param, int directory)
Constructs a TIFFImage that acquires its data from a given SeekableStream and reads from a particular IFD of the stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.WritableRaster
copyData(java.awt.image.WritableRaster wr)
private java.awt.image.ComponentColorModel
createAlphaComponentColorModel(int dataType, int numBands, boolean isAlphaPremultiplied, int transparency)
private static java.awt.image.SampleModel
createPixelInterleavedSampleModel(int dataType, int tileWidth, int tileHeight, int bands)
private byte[]
decodePackbits(byte[] data, int arraySize, byte[] dst)
private long[]
getFieldAsLongs(TIFFField field)
Return as a long[] the value of a TIFF_LONG or TIFF_SHORT field.TIFFDirectory
getPrivateIFD(long offset)
Reads a private IFD from a given offset in the stream.java.awt.image.Raster
getTile(int tileX, int tileY)
Returns tile (tileX, tileY) as a Raster.private void
inflate(byte[] deflated, byte[] inflated)
Inflatesdeflated
intoinflated
using theInflater
constructed during class instantiation.private void
interpretBytesAsInts(byte[] byteArray, int[] intArray, int intCount)
private void
interpretBytesAsShorts(byte[] byteArray, short[] shortArray, int shortCount)
private void
readInts(int intCount, int[] intArray)
private void
readShorts(int shortCount, short[] shortArray)
-
Methods inherited from class org.apache.xmlgraphics.image.rendered.AbstractRed
copyBand, copyToRaster, getBounds, getColorModel, getData, getData, getDependencyRegion, getDirtyRegion, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getProperty, getPropertyNames, getSampleModel, getSources, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidth, getXTile, getYTile, init, init, makeTile, updateTileGridInfo
-
-
-
-
Field Detail
-
COMP_NONE
public static final int COMP_NONE
- See Also:
- Constant Field Values
-
COMP_FAX_G3_1D
public static final int COMP_FAX_G3_1D
- See Also:
- Constant Field Values
-
COMP_FAX_G3_2D
public static final int COMP_FAX_G3_2D
- See Also:
- Constant Field Values
-
COMP_FAX_G4_2D
public static final int COMP_FAX_G4_2D
- See Also:
- Constant Field Values
-
COMP_LZW
public static final int COMP_LZW
- See Also:
- Constant Field Values
-
COMP_JPEG_OLD
public static final int COMP_JPEG_OLD
- See Also:
- Constant Field Values
-
COMP_JPEG_TTN2
public static final int COMP_JPEG_TTN2
- See Also:
- Constant Field Values
-
COMP_PACKBITS
public static final int COMP_PACKBITS
- See Also:
- Constant Field Values
-
COMP_DEFLATE
public static final int COMP_DEFLATE
- See Also:
- Constant Field Values
-
TYPE_UNSUPPORTED
private static final int TYPE_UNSUPPORTED
- See Also:
- Constant Field Values
-
TYPE_BILEVEL
private static final int TYPE_BILEVEL
- See Also:
- Constant Field Values
-
TYPE_GRAY_4BIT
private static final int TYPE_GRAY_4BIT
- See Also:
- Constant Field Values
-
TYPE_GRAY
private static final int TYPE_GRAY
- See Also:
- Constant Field Values
-
TYPE_GRAY_ALPHA
private static final int TYPE_GRAY_ALPHA
- See Also:
- Constant Field Values
-
TYPE_PALETTE
private static final int TYPE_PALETTE
- See Also:
- Constant Field Values
-
TYPE_RGB
private static final int TYPE_RGB
- See Also:
- Constant Field Values
-
TYPE_RGB_ALPHA
private static final int TYPE_RGB_ALPHA
- See Also:
- Constant Field Values
-
TYPE_YCBCR_SUB
private static final int TYPE_YCBCR_SUB
- See Also:
- Constant Field Values
-
TYPE_GENERIC
private static final int TYPE_GENERIC
- 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
-
stream
SeekableStream stream
-
tileSize
int tileSize
-
tilesX
int tilesX
-
tilesY
int tilesY
-
tileOffsets
long[] tileOffsets
-
tileByteCounts
long[] tileByteCounts
-
colormap
char[] colormap
-
sampleSize
int sampleSize
-
compression
int compression
-
palette
byte[] palette
-
numBands
int numBands
-
chromaSubH
int chromaSubH
-
chromaSubV
int chromaSubV
-
tiffT4Options
long tiffT4Options
-
tiffT6Options
long tiffT6Options
-
fillOrder
int fillOrder
-
predictor
int predictor
-
inflater
java.util.zip.Inflater inflater
-
isBigEndian
boolean isBigEndian
-
imageType
int imageType
-
isWhiteZero
boolean isWhiteZero
-
dataType
int dataType
-
decodePaletteAsShorts
boolean decodePaletteAsShorts
-
tiled
boolean tiled
-
decoder
private TIFFFaxDecoder decoder
-
lzwDecoder
private TIFFLZWDecoder lzwDecoder
-
-
Constructor Detail
-
TIFFImage
public TIFFImage(SeekableStream stream, TIFFDecodeParam param, int directory) throws java.io.IOException
Constructs a TIFFImage that acquires its data from a given SeekableStream and reads from a particular IFD of the stream. The index of the first IFD is 0.- Parameters:
stream
- the SeekableStream to read from.param
- an instance of TIFFDecodeParam, or null.directory
- the index of the IFD to read from.- Throws:
java.io.IOException
-
-
Method Detail
-
inflate
private void inflate(byte[] deflated, byte[] inflated)
Inflatesdeflated
intoinflated
using theInflater
constructed during class instantiation.
-
createPixelInterleavedSampleModel
private static java.awt.image.SampleModel createPixelInterleavedSampleModel(int dataType, int tileWidth, int tileHeight, int bands)
-
getFieldAsLongs
private long[] getFieldAsLongs(TIFFField field)
Return as a long[] the value of a TIFF_LONG or TIFF_SHORT field.
-
getPrivateIFD
public TIFFDirectory getPrivateIFD(long offset) throws java.io.IOException
Reads a private IFD from a given offset in the stream. This method may be used to obtain IFDs that are referenced only by private tag values.- Throws:
java.io.IOException
-
copyData
public java.awt.image.WritableRaster copyData(java.awt.image.WritableRaster wr)
-
getTile
public java.awt.image.Raster getTile(int tileX, int tileY)
Returns tile (tileX, tileY) as a Raster.- Specified by:
getTile
in interfacejava.awt.image.RenderedImage
- Overrides:
getTile
in classAbstractRed
-
readShorts
private void readShorts(int shortCount, short[] shortArray)
-
readInts
private void readInts(int intCount, int[] intArray)
-
interpretBytesAsShorts
private void interpretBytesAsShorts(byte[] byteArray, short[] shortArray, int shortCount)
-
interpretBytesAsInts
private void interpretBytesAsInts(byte[] byteArray, int[] intArray, int intCount)
-
decodePackbits
private byte[] decodePackbits(byte[] data, int arraySize, byte[] dst)
-
createAlphaComponentColorModel
private java.awt.image.ComponentColorModel createAlphaComponentColorModel(int dataType, int numBands, boolean isAlphaPremultiplied, int transparency)
-
-