Class PNGRed

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

    public class PNGRed
    extends AbstractRed
    Version:
    $Id: PNGRed.java 1732018 2016-02-24 04:51:06Z gadams $
    • Field Detail

      • colorTypeNames

        private static final java.lang.String[] colorTypeNames
      • bandOffsets

        private int[][] bandOffsets
      • bitDepth

        private int bitDepth
      • colorType

        private int colorType
      • compressionMethod

        private int compressionMethod
      • filterMethod

        private int filterMethod
      • interlaceMethod

        private int interlaceMethod
      • paletteEntries

        private int paletteEntries
      • redPalette

        private byte[] redPalette
      • greenPalette

        private byte[] greenPalette
      • bluePalette

        private byte[] bluePalette
      • alphaPalette

        private byte[] alphaPalette
      • bkgdRed

        private int bkgdRed
      • bkgdGreen

        private int bkgdGreen
      • bkgdBlue

        private int bkgdBlue
      • grayTransparentAlpha

        private int grayTransparentAlpha
      • redTransparentAlpha

        private int redTransparentAlpha
      • greenTransparentAlpha

        private int greenTransparentAlpha
      • blueTransparentAlpha

        private int blueTransparentAlpha
      • maxOpacity

        private int maxOpacity
      • significantBits

        private int[] significantBits
      • suppressAlpha

        private boolean suppressAlpha
      • expandPalette

        private boolean expandPalette
      • output8BitGray

        private boolean output8BitGray
      • outputHasAlphaPalette

        private boolean outputHasAlphaPalette
      • performGammaCorrection

        private boolean performGammaCorrection
      • expandGrayAlpha

        private boolean expandGrayAlpha
      • generateEncodeParam

        private boolean generateEncodeParam
      • emitProperties

        private boolean emitProperties
      • fileGamma

        private float fileGamma
      • userExponent

        private float userExponent
      • displayExponent

        private float displayExponent
      • chromaticity

        private float[] chromaticity
      • sRGBRenderingIntent

        private int sRGBRenderingIntent
      • postProcess

        private int postProcess
      • POST_GRAY_LUT_ADD_TRANS

        private static final int POST_GRAY_LUT_ADD_TRANS
        See Also:
        Constant Field Values
      • POST_REMOVE_GRAY_TRANS

        private static final int POST_REMOVE_GRAY_TRANS
        See Also:
        Constant Field Values
      • POST_GRAY_LUT_ADD_TRANS_EXP

        private static final int POST_GRAY_LUT_ADD_TRANS_EXP
        See Also:
        Constant Field Values
      • POST_ADD_GRAY_TRANS_EXP

        private static final int POST_ADD_GRAY_TRANS_EXP
        See Also:
        Constant Field Values
      • streamVec

        private java.util.List<java.io.InputStream> streamVec
      • dataStream

        private java.io.DataInputStream dataStream
      • bytesPerPixel

        private int bytesPerPixel
      • inputBands

        private int inputBands
      • outputBands

        private int outputBands
      • chunkIndex

        private int chunkIndex
      • textKeys

        private java.util.List textKeys
      • textStrings

        private java.util.List textStrings
      • ztextKeys

        private java.util.List ztextKeys
      • ztextStrings

        private java.util.List ztextStrings
      • theTile

        private java.awt.image.WritableRaster theTile
      • bounds

        private java.awt.Rectangle bounds
      • properties

        private java.util.Map<java.lang.String,​java.lang.Object> properties
        A Hashtable containing the image properties.
      • gammaLut

        private int[] gammaLut
      • expandBits

        private final byte[][] expandBits
      • grayLut

        private int[] grayLut
      • GrayBits8

        private static final int[] GrayBits8
      • colorModelGray8

        private static final java.awt.image.ComponentColorModel colorModelGray8
      • GrayAlphaBits8

        private static final int[] GrayAlphaBits8
      • colorModelGrayAlpha8

        private static final java.awt.image.ComponentColorModel colorModelGrayAlpha8
      • GrayBits16

        private static final int[] GrayBits16
      • colorModelGray16

        private static final java.awt.image.ComponentColorModel colorModelGray16
      • GrayAlphaBits16

        private static final int[] GrayAlphaBits16
      • colorModelGrayAlpha16

        private static final java.awt.image.ComponentColorModel colorModelGrayAlpha16
      • GrayBits32

        private static final int[] GrayBits32
      • colorModelGray32

        private static final java.awt.image.ComponentColorModel colorModelGray32
      • GrayAlphaBits32

        private static final int[] GrayAlphaBits32
      • colorModelGrayAlpha32

        private static final java.awt.image.ComponentColorModel colorModelGrayAlpha32
      • RGBBits8

        private static final int[] RGBBits8
      • colorModelRGB8

        private static final java.awt.image.ComponentColorModel colorModelRGB8
      • RGBABits8

        private static final int[] RGBABits8
      • colorModelRGBA8

        private static final java.awt.image.ComponentColorModel colorModelRGBA8
      • RGBBits16

        private static final int[] RGBBits16
      • colorModelRGB16

        private static final java.awt.image.ComponentColorModel colorModelRGB16
      • RGBABits16

        private static final int[] RGBABits16
      • colorModelRGBA16

        private static final java.awt.image.ComponentColorModel colorModelRGBA16
      • RGBBits32

        private static final int[] RGBBits32
      • colorModelRGB32

        private static final java.awt.image.ComponentColorModel colorModelRGB32
      • RGBABits32

        private static final int[] RGBABits32
      • colorModelRGBA32

        private static final java.awt.image.ComponentColorModel colorModelRGBA32
    • Constructor Detail

      • PNGRed

        public PNGRed​(java.io.InputStream stream)
               throws java.io.IOException
        Throws:
        java.io.IOException
      • PNGRed

        public PNGRed​(java.io.InputStream stream,
                      PNGDecodeParam decodeParam)
               throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • initGammaLut

        private void initGammaLut​(int bits)
      • initGrayLut

        private void initGrayLut​(int bits)
      • getChunkType

        private static java.lang.String getChunkType​(java.io.DataInputStream distream)
      • readChunk

        private static PNGRed.PNGChunk readChunk​(java.io.DataInputStream distream)
      • parse_IHDR_chunk

        private void parse_IHDR_chunk​(PNGRed.PNGChunk chunk)
      • parse_IEND_chunk

        private void parse_IEND_chunk​(PNGRed.PNGChunk chunk)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createComponentColorModel

        public static java.awt.image.ColorModel createComponentColorModel​(java.awt.image.SampleModel sm)
        A convenience method to create an instance of ComponentColorModel suitable for use with the given SampleModel. The SampleModel should have a data type of DataBuffer.TYPE_BYTE, TYPE_USHORT, or TYPE_INT and between 1 and 4 bands. Depending on the number of bands of the SampleModel, either a gray, gray+alpha, rgb, or rgb+alpha ColorModel is returned.
      • parse_PLTE_chunk

        private void parse_PLTE_chunk​(PNGRed.PNGChunk chunk)
      • parse_bKGD_chunk

        private void parse_bKGD_chunk​(PNGRed.PNGChunk chunk)
      • parse_cHRM_chunk

        private void parse_cHRM_chunk​(PNGRed.PNGChunk chunk)
      • parse_gAMA_chunk

        private void parse_gAMA_chunk​(PNGRed.PNGChunk chunk)
      • parse_hIST_chunk

        private void parse_hIST_chunk​(PNGRed.PNGChunk chunk)
      • parse_pHYs_chunk

        private void parse_pHYs_chunk​(PNGRed.PNGChunk chunk)
      • parse_sBIT_chunk

        private void parse_sBIT_chunk​(PNGRed.PNGChunk chunk)
      • parse_sRGB_chunk

        private void parse_sRGB_chunk​(PNGRed.PNGChunk chunk)
      • parse_tEXt_chunk

        private void parse_tEXt_chunk​(PNGRed.PNGChunk chunk)
      • parse_tIME_chunk

        private void parse_tIME_chunk​(PNGRed.PNGChunk chunk)
      • parse_tRNS_chunk

        private void parse_tRNS_chunk​(PNGRed.PNGChunk chunk)
      • parse_zTXt_chunk

        private void parse_zTXt_chunk​(PNGRed.PNGChunk chunk)
      • createRaster

        private java.awt.image.WritableRaster createRaster​(int width,
                                                           int height,
                                                           int bands,
                                                           int scanlineStride,
                                                           int bitDepth)
      • decodeSubFilter

        private static void decodeSubFilter​(byte[] curr,
                                            int count,
                                            int bpp)
      • decodeUpFilter

        private static void decodeUpFilter​(byte[] curr,
                                           byte[] prev,
                                           int count)
      • decodeAverageFilter

        private static void decodeAverageFilter​(byte[] curr,
                                                byte[] prev,
                                                int count,
                                                int bpp)
      • paethPredictor

        private static int paethPredictor​(int a,
                                          int b,
                                          int c)
      • decodePaethFilter

        private static void decodePaethFilter​(byte[] curr,
                                              byte[] prev,
                                              int count,
                                              int bpp)
      • processPixels

        private void processPixels​(int process,
                                   java.awt.image.Raster src,
                                   java.awt.image.WritableRaster dst,
                                   int xOffset,
                                   int step,
                                   int y,
                                   int width)
      • decodePass

        private void decodePass​(java.awt.image.WritableRaster imRas,
                                int xOffset,
                                int yOffset,
                                int xStep,
                                int yStep,
                                int passWidth,
                                int passHeight)
        Reads in an image of a given size and returns it as a WritableRaster.
      • decodeImage

        private void decodeImage​(boolean useInterlacing)
      • copyData

        public java.awt.image.WritableRaster copyData​(java.awt.image.WritableRaster wr)
      • getTile

        public java.awt.image.Raster getTile​(int tileX,
                                             int tileY)
        Specified by:
        getTile in interface java.awt.image.RenderedImage
        Overrides:
        getTile in class AbstractRed