public class TIFFNullDecompressor extends TIFFDecompressor
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
DEBUG |
private boolean |
isReadActiveOnly
Whether to read the active source region only.
|
private int |
originalSrcHeight
The original value of
srcHeight. |
private int |
originalSrcMinX
The original value of
srcMinX. |
private int |
originalSrcMinY
The original value of
srcMinY. |
private int |
originalSrcWidth
The original value of
srcWidth. |
activeSrcHeight, activeSrcMinX, activeSrcMinY, activeSrcWidth, bitsPerSample, byteCount, colorConverter, colorMap, compression, destinationBands, dstHeight, dstMinX, dstMinY, dstWidth, dstXOffset, dstYOffset, extraSamples, image, metadata, offset, photometricInterpretation, planar, rawImage, reader, sampleFormat, samplesPerPixel, sourceBands, sourceXOffset, sourceYOffset, srcHeight, srcMinX, srcMinY, srcWidth, stream, subsampleX, subsampleY| Constructor and Description |
|---|
TIFFNullDecompressor() |
| Modifier and Type | Method and Description |
|---|---|
void |
beginDecoding()
This routine is called prior to a sequence of calls to the
decode method, in order to allow any necessary
tables or other structures to be initialized based on metadata
values. |
void |
decode()
Decodes the input bit stream (located in the
ImageInputStream stream, at offset
offset, and continuing for byteCount
bytes) into the output BufferedImage
image. |
void |
decodeRaw(byte[] b,
int dstOffset,
int bitsPerPixel,
int scanlineStride)
Decodes the source data into the provided
byte
array b, starting at the offset given by
dstOffset. |
createRawImage, decodeRaw, decodeRaw, decodeRaw, getRawImageType, getRawImageTypeSpecifier, setActiveSrcHeight, setActiveSrcMinX, setActiveSrcMinY, setActiveSrcWidth, setBitsPerSample, setByteCount, setColorConverter, setColorMap, setCompression, setDestinationBands, setDstHeight, setDstMinX, setDstMinY, setDstWidth, setDstXOffset, setDstYOffset, setExtraSamples, setImage, setMetadata, setOffset, setPhotometricInterpretation, setPlanar, setReader, setSampleFormat, setSamplesPerPixel, setSourceBands, setSourceXOffset, setSourceYOffset, setSrcHeight, setSrcMinX, setSrcMinY, setSrcWidth, setStream, setSubsampleX, setSubsampleYprivate static final boolean DEBUG
private boolean isReadActiveOnly
private int originalSrcMinX
srcMinX.private int originalSrcMinY
srcMinY.private int originalSrcWidth
srcWidth.private int originalSrcHeight
srcHeight.public void beginDecoding()
TIFFDecompressordecode method, in order to allow any necessary
tables or other structures to be initialized based on metadata
values. This routine is guaranteed to be called any time the
metadata values have changed.
The default implementation computes tables used by the
decode method to rescale components to different
bit depths. Thus, if this method is overridden, it is
important for the subclass method to call super(),
unless it overrides decode as well.
beginDecoding in class TIFFDecompressorpublic void decode()
throws IOException
TIFFDecompressorImageInputStream stream, at offset
offset, and continuing for byteCount
bytes) into the output BufferedImage
image.
The default implementation analyzes the destination image
to determine if it is suitable as the destination for the
decodeRaw method. If not, a suitable image is
created. Next, decodeRaw is called to perform the
actual decoding, and the results are copied into the
destination image if necessary. Subsampling and offsetting are
performed automatically.
The precise responsibilities of this routine are as
follows. The input bit stream is defined by the instance
variables stream, offset, and
byteCount. These bits contain the data for the
region of the source image defined by srcMinX,
srcMinY, srcWidth, and
srcHeight.
The source data is required to be subsampling, starting at
the sourceXOffsetth column and including
every subsampleXth pixel thereafter (and similarly
for sourceYOffset and
subsampleY).
Pixels are copied into the destination with an addition shift of
(dstXOffset, dstYOffset). The complete
set of formulas relating the source and destination coordinate spaces
are:
dx = (sx - sourceXOffset)/subsampleX + dstXOffset; dy = (sy - sourceYOffset)/subsampleY + dstYOffset;Only source pixels such that
(sx - sourceXOffset) %
subsampleX == 0 and (sy - sourceYOffset) %
subsampleY == 0 are copied.
The inverse mapping, from destination to source coordinates, is one-to-one:
sx = (dx - dstXOffset)*subsampleX + sourceXOffset; sy = (dy - dstYOffset)*subsampleY + sourceYOffset;
The region of the destination image to be updated is given
by the instance variables dstMinX,
dstMinY, dstWidth, and
dstHeight.
It is possible that not all of the source data being read
will contribute to the destination image. For example, the
destination offsets could be set such that some of the source
pixels land outside of the bounds of the image. As a
convenience, the bounds of the active source region (that is,
the region of the strip or tile being read that actually
contributes to the destination image, taking clipping into
account) are available as activeSrcMinX,
activeSrcMinY, activeSrcWidth and
activeSrcHeight. Thus, the source pixel at
(activeSrcMinX, activeSrcMinY) will
map to the destination pixel (dstMinX,
dstMinY).
The sequence of source bands given by
sourceBands are to be copied into the sequence of
bands in the destination given by
destinationBands.
Some standard tag information is provided the instance
variables photometricInterpretation,
compression, samplesPerPixel,
bitsPerSample, sampleFormat,
extraSamples, and colorMap.
In practice, unless there is a significant performance
advantage to be gained by overriding this routine, most users
will prefer to use the default implementation of this routine,
and instead override the decodeRaw and/or
getRawImageType methods.
decode in class TIFFDecompressorIOException - if an error occurs in
decodeRaw.public void decodeRaw(byte[] b,
int dstOffset,
int bitsPerPixel,
int scanlineStride)
throws IOException
TIFFDecompressorbyte
array b, starting at the offset given by
dstOffset. Each pixel occupies
bitsPerPixel bits, with no padding between pixels.
Scanlines are separated by scanlineStride
bytes.decodeRaw in class TIFFDecompressorb - a byte array to be written.dstOffset - the starting offset in b to be
written.bitsPerPixel - the number of bits for each pixel.scanlineStride - the number of bytes to
advance between that starting pixels of each scanline.IOException - if an error occurs reading from the source
ImageInputStream.Copyright © 2017 Open Microscopy Environment