Class TIFFNullDecompressor

    • Field Detail

      • isReadActiveOnly

        private boolean isReadActiveOnly
        Whether to read the active source region only.
      • originalSrcMinX

        private int originalSrcMinX
        The original value of srcMinX.
      • originalSrcMinY

        private int originalSrcMinY
        The original value of srcMinY.
      • originalSrcWidth

        private int originalSrcWidth
        The original value of srcWidth.
      • originalSrcHeight

        private int originalSrcHeight
        The original value of srcHeight.
    • Constructor Detail

      • TIFFNullDecompressor

        public TIFFNullDecompressor()
    • Method Detail

      • beginDecoding

        public void beginDecoding()
        Description copied from class: TIFFDecompressor
        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. 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.

        Overrides:
        beginDecoding in class TIFFDecompressor
      • decode

        public void decode()
                    throws java.io.IOException
        Description copied from class: TIFFDecompressor
        Decodes the input bit stream (located in the ImageInputStream 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.

        Overrides:
        decode in class TIFFDecompressor
        Throws:
        java.io.IOException - if an error occurs in decodeRaw.
      • decodeRaw

        public void decodeRaw​(byte[] b,
                              int dstOffset,
                              int bitsPerPixel,
                              int scanlineStride)
                       throws java.io.IOException
        Description copied from class: TIFFDecompressor
        Decodes the source data into the provided byte 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.
        Specified by:
        decodeRaw in class TIFFDecompressor
        Parameters:
        b - 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.
        Throws:
        java.io.IOException - if an error occurs reading from the source ImageInputStream.