Class TIFFImage

  • All Implemented Interfaces:
    java.awt.image.RenderedImage, CachableRed

    public class TIFFImage
    extends AbstractRed
    • 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)
        Inflates deflated into inflated using the Inflater 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 interface java.awt.image.RenderedImage
        Overrides:
        getTile in class AbstractRed
      • 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)