Class TIFFNullDecompressor
-
Field Summary
Fields inherited from class com.sun.media.imageio.plugins.tiff.TIFFDecompressor
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis routine is called prior to a sequence of calls to thedecodemethod, in order to allow any necessary tables or other structures to be initialized based on metadata values.voiddecode()Decodes the input bit stream (located in theImageInputStreamstream, at offsetoffset, and continuing forbyteCountbytes) into the outputBufferedImageimage.voiddecodeRaw(byte[] b, int dstOffset, int bitsPerPixel, int scanlineStride) Decodes the source data into the providedbytearrayb, starting at the offset given bydstOffset.Methods inherited from class com.sun.media.imageio.plugins.tiff.TIFFDecompressor
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, setSubsampleY
-
Constructor Details
-
TIFFNullDecompressor
public TIFFNullDecompressor()
-
-
Method Details
-
beginDecoding
public void beginDecoding()Description copied from class:TIFFDecompressorThis routine is called prior to a sequence of calls to thedecodemethod, 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
decodemethod to rescale components to different bit depths. Thus, if this method is overridden, it is important for the subclass method to callsuper(), unless it overridesdecodeas well.- Overrides:
beginDecodingin classTIFFDecompressor
-
decode
Description copied from class:TIFFDecompressorDecodes the input bit stream (located in theImageInputStreamstream, at offsetoffset, and continuing forbyteCountbytes) into the outputBufferedImageimage.The default implementation analyzes the destination image to determine if it is suitable as the destination for the
decodeRawmethod. If not, a suitable image is created. Next,decodeRawis 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, andbyteCount. These bits contain the data for the region of the source image defined bysrcMinX,srcMinY,srcWidth, andsrcHeight.The source data is required to be subsampling, starting at the
sourceXOffsetth column and including everysubsampleXth pixel thereafter (and similarly forsourceYOffsetandsubsampleY).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 == 0and(sy - sourceYOffset) % subsampleY == 0are 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, anddstHeight.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,activeSrcWidthandactiveSrcHeight. Thus, the source pixel at (activeSrcMinX,activeSrcMinY) will map to the destination pixel (dstMinX,dstMinY).The sequence of source bands given by
sourceBandsare to be copied into the sequence of bands in the destination given bydestinationBands.Some standard tag information is provided the instance variables
photometricInterpretation,compression,samplesPerPixel,bitsPerSample,sampleFormat,extraSamples, andcolorMap.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
decodeRawand/orgetRawImageTypemethods.- Overrides:
decodein classTIFFDecompressor- Throws:
IOException- if an error occurs indecodeRaw.
-
decodeRaw
public void decodeRaw(byte[] b, int dstOffset, int bitsPerPixel, int scanlineStride) throws IOException Description copied from class:TIFFDecompressorDecodes the source data into the providedbytearrayb, starting at the offset given bydstOffset. Each pixel occupiesbitsPerPixelbits, with no padding between pixels. Scanlines are separated byscanlineStridebytes.- Specified by:
decodeRawin classTIFFDecompressor- Parameters:
b- abytearray to be written.dstOffset- the starting offset inbto be written.bitsPerPixel- the number of bits for each pixel.scanlineStride- the number ofbytes to advance between that starting pixels of each scanline.- Throws:
IOException- if an error occurs reading from the sourceImageInputStream.
-