|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.tidalwave.imageio.raw.RasterReader
public class RasterReader
A RasterReader is capable of reading raster data from an image
stream. Different format SPI will subclass it to implement specialized
versions. This class should be invoked by a subclass of
RAWImageReaderSupport.
This class must be filled with the proper raster attributes, then the method
loadRaster(RAWImageInputStream, RAWImageReaderSupport)
must be called.
The following attributes are mandatory:
| Field Summary | |
|---|---|
static int |
B_OFFSET
|
protected int |
bitsPerSample
The number of bits per sample. |
protected int[] |
cfaOffsets
The CFA offsets. |
protected int |
compression
The compression type. |
static int |
G_OFFSET
|
protected int[] |
linearizationTable
The linearization table. |
static int |
R_OFFSET
|
protected long |
rasterOffset
The offset of the raster data. |
protected int |
stripByteCount
The number of strips for stripped rasters. |
protected int |
tileHeight
The height of a tile for tiled rasters. |
protected int[] |
tileOffsets
The offsets of tiles. |
protected int |
tilesAcross
The count of tiles that span horizontally. |
protected int |
tilesDown
The count of tiles that span vertically. |
protected int |
tileWidth
The width of a tile for tiled rasters. |
| Constructor Summary | |
|---|---|
RasterReader()
|
|
| Method Summary | |
|---|---|
protected java.awt.image.WritableRaster |
createRaster()
Creates a raster compatible with the specified attributes. |
protected int |
getRow(int interlacedRow,
int height)
This method returns the row number given the current row. |
protected int |
getSkipCountAtColumn(int x)
Some RAW formats require that a certain number of bits is skipped at certain columns. |
protected int |
getSkipCountAtEndOfRow()
Some RAW formats require that a certain number of bits s skipped at the end of each row. |
protected boolean |
isCompressedRaster()
This method returns true if a compressed raster is supported. |
protected void |
loadCompressedRaster(RAWImageInputStream iis,
java.awt.image.WritableRaster raster,
RAWImageReaderSupport ir)
Reads a compressed raster. |
java.awt.image.WritableRaster |
loadRaster(RAWImageInputStream iis,
RAWImageReaderSupport ir)
Loads the raster from the stream and creates a WritableRaster. |
protected void |
loadUncompressedRaster(RAWImageInputStream iis,
java.awt.image.WritableRaster raster,
RAWImageReaderSupport ir)
Reads an uncompressed raster. |
protected void |
selectBitReader(RAWImageInputStream iis,
java.awt.image.WritableRaster raster,
int bitsPerSample)
Creates the most efficient BitReader, which
is the faster for the given number of bits per sample. |
void |
setBitsPerSample(int bitsPerSample)
Sets the bits per sample of the raster to read. |
void |
setCFAPattern(byte[] cfaPattern)
Sets the CFA pattern of the raster to read |
void |
setCompression(int compression)
Sets the compression type. |
void |
setHeight(int height)
Sets the height of the raster to read. |
void |
setLinearizationTable(int[] linearizationTable)
Sets the linearization table. |
void |
setRasterOffset(long rasterOffset)
Sets the offset of the raster data |
void |
setStripByteCount(int stripByteCount)
Sets the number of strips for stripped rasters. |
void |
setTileHeight(int tileHeight)
Sets the tile height of tiled rasters. |
void |
setTileOffsets(int[] tileOffsets)
Sets the offsets to tile data for tiled rasters. |
void |
setTilesAcross(int tilesAcross)
Sets the count of horizontal tiles for tiled rasters. |
void |
setTilesDown(int tilesDown)
Sets the count of vertical tiles for tiled rasters. |
void |
setTileWidth(int tileWidth)
Sets the tile width of tiled rasters. |
void |
setWidth(int width)
Sets the width of the raster to read. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int R_OFFSET
public static final int G_OFFSET
public static final int B_OFFSET
protected int bitsPerSample
protected int[] cfaOffsets
protected int stripByteCount
protected int tileWidth
protected int tileHeight
protected int tilesAcross
protected int tilesDown
protected int[] tileOffsets
protected int[] linearizationTable
protected int compression
protected long rasterOffset
| Constructor Detail |
|---|
public RasterReader()
| Method Detail |
|---|
public void setWidth(int width)
width - the width of the rasterpublic void setHeight(int height)
height - the height of the rasterpublic void setCFAPattern(byte[] cfaPattern)
cfaPattern - the CFA patternpublic void setBitsPerSample(int bitsPerSample)
bitsPerSample - the bits per sample valuepublic void setTileWidth(int tileWidth)
tileWidth - the tile widthpublic void setTileHeight(int tileHeight)
tileHeight - the tile heightpublic void setTilesAcross(int tilesAcross)
tilesAcross - the count of horizontal tilespublic void setTilesDown(int tilesDown)
tilesDown - the count of vertical tilespublic void setTileOffsets(int[] tileOffsets)
tileOffsets - the tile offsetspublic void setRasterOffset(long rasterOffset)
rasterOffset - the offset of raster datapublic void setStripByteCount(int stripByteCount)
stripByteCount - the number of stripspublic void setCompression(int compression)
compression - the compression typepublic void setLinearizationTable(int[] linearizationTable)
linearizationTable - the linearization table
public final java.awt.image.WritableRaster loadRaster(RAWImageInputStream iis,
RAWImageReaderSupport ir)
throws java.io.IOException
WritableRaster.
This method makes sure that the mandatory attributes have been set, then
asks to isCompressedRaster() if the current raster is compressed. If
it is, the method
loadCompressedRaster(RAWImageInputStream,WritableRaster,RAWImageReaderSupport)
will be invoked; otherwise the method
loadUncompressedRaster(RAWImageInputStream,WritableRaster,RAWImageReaderSupport)
is invoked. The raster is created by calling the method createRaster().
iis - the image input streamir - the image reader
java.io.IOException - if an I/O error occurs
protected void loadUncompressedRaster(RAWImageInputStream iis,
java.awt.image.WritableRaster raster,
RAWImageReaderSupport ir)
throws java.io.IOException
iis - the image input streamraster - the raster to read data intoir - the image reader
java.io.IOException - if an I/O error occurs
protected void loadCompressedRaster(RAWImageInputStream iis,
java.awt.image.WritableRaster raster,
RAWImageReaderSupport ir)
throws java.io.IOException
iis - the image input streamraster - the raster to read data intoir - the image reader
java.io.IOException - if an I/O error occursprotected java.awt.image.WritableRaster createRaster()
PixelInterleavedSampleModel
rather than a sun.awt.image.ShortBandedRaster, since the latter
triggers bugs in the image filtering engine.
protected void selectBitReader(RAWImageInputStream iis,
java.awt.image.WritableRaster raster,
int bitsPerSample)
BitReader, which
is the faster for the given number of bits per sample.
iis - the image input streamraster - the raster to read data intobitsPerSample - the number of bits per sampleprotected boolean isCompressedRaster()
false by default: subclasses should implement a test and return
the most appropriate value.
protected int getRow(int interlacedRow,
int height)
interlacedRow - the current rowheight - the height of the raster
protected int getSkipCountAtColumn(int x)
x - the column
protected int getSkipCountAtEndOfRow()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||