Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

non_com.media.jai.codec
Class PNGImage  view PNGImage download PNGImage.java

java.lang.Object
  extended bynon_com.media.jai.codec.SimpleRenderedImage
      extended bynon_com.media.jai.codec.PNGImage
All Implemented Interfaces:
java.awt.image.RenderedImage

class PNGImage
extends SimpleRenderedImage

TO DO: zTXt chunks


Field Summary
private  byte[] alphaPalette
           
private  int[][] bandOffsets
           
private  int bitDepth
           
private  int bkgdBlue
           
private  int bkgdGreen
           
private  int bkgdRed
           
private static int BLUE_OFFSET
           
private  byte[] bluePalette
           
private  int blueTransparentAlpha
           
private  int bytesPerPixel
           
private  float[] chromaticity
           
private  int chunkIndex
           
private  int colorType
           
private static java.lang.String[] colorTypeNames
           
private  int compressionMethod
           
private  java.io.DataInputStream dataStream
           
private  PNGDecodeParam decodeParam
           
private  float displayExponent
           
private  boolean emitProperties
           
private  PNGEncodeParam encodeParam
           
private  byte[][] expandBits
           
private  boolean expandGrayAlpha
           
private  boolean expandPalette
           
private  float fileGamma
           
private  int filterMethod
           
private  int[] gammaLut
           
private  boolean generateEncodeParam
           
private  int[] grayLut
           
private  int grayTransparentAlpha
           
private static int GREEN_OFFSET
           
private  byte[] greenPalette
           
private  int greenTransparentAlpha
           
private  boolean hasBackground
           
private  int inputBands
           
private  int interlaceMethod
           
private  int maxOpacity
           
private  boolean output8BitGray
           
private  int outputBands
           
private  boolean outputHasAlphaPalette
           
private  int paletteEntries
           
private  boolean performGammaCorrection
           
static int PNG_COLOR_GRAY
          Description of the Field
static int PNG_COLOR_GRAY_ALPHA
          Description of the Field
static int PNG_COLOR_PALETTE
          Description of the Field
static int PNG_COLOR_RGB
          Description of the Field
static int PNG_COLOR_RGB_ALPHA
          Description of the Field
static int PNG_FILTER_AVERAGE
          Description of the Field
static int PNG_FILTER_NONE
          Description of the Field
static int PNG_FILTER_PAETH
          Description of the Field
static int PNG_FILTER_SUB
          Description of the Field
static int PNG_FILTER_UP
          Description of the Field
private static int POST_ADD_GRAY_TRANS
           
private static int POST_ADD_GRAY_TRANS_EXP
           
private static int POST_ADD_RGB_TRANS
           
private static int POST_EXP_MASK
           
private static int POST_GAMMA
           
private static int POST_GAMMA_EXP
           
private static int POST_GRAY_ALPHA_EXP
           
private static int POST_GRAY_LUT
           
private static int POST_GRAY_LUT_ADD_TRANS
           
private static int POST_GRAY_LUT_ADD_TRANS_EXP
           
private static int POST_NONE
           
private static int POST_PALETTE_TO_RGB
           
private static int POST_PALETTE_TO_RGBA
           
private static int POST_REMOVE_GRAY_TRANS
           
private static int POST_REMOVE_RGB_TRANS
           
private  int postProcess
           
private static int RED_OFFSET
           
private  byte[] redPalette
           
private  int redTransparentAlpha
           
private  int[] significantBits
           
private  int sRGBRenderingIntent
           
private  java.util.Vector streamVec
           
private  boolean suppressAlpha
           
private  java.util.Vector textKeys
           
private  java.util.Vector textStrings
           
private  java.awt.image.WritableRaster theTile
           
private  float userExponent
           
private  java.util.Vector ztextKeys
           
private  java.util.Vector ztextStrings
           
 
Fields inherited from class non_com.media.jai.codec.SimpleRenderedImage
colorModel, height, minX, minY, properties, sampleModel, sources, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width
 
Constructor Summary
PNGImage(java.io.InputStream stream, PNGDecodeParam decodeParam)
          Constructor for the PNGImage object
 
Method Summary
private  java.awt.image.WritableRaster createRaster(int width, int height, int bands, int scanlineStride, int bitDepth)
           
private static void decodeAverageFilter(byte[] curr, byte[] prev, int count, int bpp)
           
private  void decodeImage(boolean useInterlacing)
           
private static void decodePaethFilter(byte[] curr, byte[] prev, int count, int bpp)
           
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.
private static void decodeSubFilter(byte[] curr, int count, int bpp)
           
private static void decodeUpFilter(byte[] curr, byte[] prev, int count)
           
private static java.lang.String getChunkType(java.io.DataInputStream distream)
           
 java.awt.image.Raster getTile(int tileX, int tileY)
          Gets the Tile attribute of the PNGImage object
private  void initGammaLut(int bits)
           
private  void initGrayLut(int bits)
           
private static int paethPredictor(int a, int b, int c)
           
private  void parse_bKGD_chunk(PNGChunk chunk)
           
private  void parse_cHRM_chunk(PNGChunk chunk)
           
private  void parse_gAMA_chunk(PNGChunk chunk)
           
private  void parse_hIST_chunk(PNGChunk chunk)
           
private  void parse_iCCP_chunk(PNGChunk chunk)
           
private  void parse_IEND_chunk(PNGChunk chunk)
           
private  void parse_IHDR_chunk(PNGChunk chunk)
           
private  void parse_pHYs_chunk(PNGChunk chunk)
           
private  void parse_PLTE_chunk(PNGChunk chunk)
           
private  void parse_sBIT_chunk(PNGChunk chunk)
           
private  void parse_sRGB_chunk(PNGChunk chunk)
           
private  void parse_tEXt_chunk(PNGChunk chunk)
           
private  void parse_tIME_chunk(PNGChunk chunk)
           
private  void parse_tRNS_chunk(PNGChunk chunk)
           
private  void parse_zTXt_chunk(PNGChunk chunk)
           
private  void processPixels(int process, java.awt.image.Raster src, java.awt.image.WritableRaster dst, int xOffset, int step, int y, int width)
           
private static PNGChunk readChunk(java.io.DataInputStream distream)
           
 
Methods inherited from class non_com.media.jai.codec.SimpleRenderedImage
copyData, getBounds, getColorModel, getData, getData, getHeight, getMaxTileX, getMaxTileY, getMaxX, getMaxY, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getProperty, getPropertyNames, getPropertyNames, getSampleModel, getSources, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidth, tileXToX, tileXToX, tileYToY, tileYToY, XToTileX, XToTileX, YToTileY, YToTileY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PNG_COLOR_GRAY

public static final int PNG_COLOR_GRAY
Description of the Field

See Also:
Constant Field Values

PNG_COLOR_RGB

public static final int PNG_COLOR_RGB
Description of the Field

See Also:
Constant Field Values

PNG_COLOR_PALETTE

public static final int PNG_COLOR_PALETTE
Description of the Field

See Also:
Constant Field Values

PNG_COLOR_GRAY_ALPHA

public static final int PNG_COLOR_GRAY_ALPHA
Description of the Field

See Also:
Constant Field Values

PNG_COLOR_RGB_ALPHA

public static final int PNG_COLOR_RGB_ALPHA
Description of the Field

See Also:
Constant Field Values

PNG_FILTER_NONE

public static final int PNG_FILTER_NONE
Description of the Field

See Also:
Constant Field Values

PNG_FILTER_SUB

public static final int PNG_FILTER_SUB
Description of the Field

See Also:
Constant Field Values

PNG_FILTER_UP

public static final int PNG_FILTER_UP
Description of the Field

See Also:
Constant Field Values

PNG_FILTER_AVERAGE

public static final int PNG_FILTER_AVERAGE
Description of the Field

See Also:
Constant Field Values

PNG_FILTER_PAETH

public static final int PNG_FILTER_PAETH
Description of the Field

See Also:
Constant Field Values

colorTypeNames

private static final java.lang.String[] colorTypeNames

RED_OFFSET

private static final int RED_OFFSET
See Also:
Constant Field Values

GREEN_OFFSET

private static final int GREEN_OFFSET
See Also:
Constant Field Values

BLUE_OFFSET

private static final int BLUE_OFFSET
See Also:
Constant Field Values

POST_NONE

private static final int POST_NONE
See Also:
Constant Field Values

POST_GAMMA

private static final int POST_GAMMA
See Also:
Constant Field Values

POST_GRAY_LUT

private static final int POST_GRAY_LUT
See Also:
Constant Field Values

POST_GRAY_LUT_ADD_TRANS

private static final int POST_GRAY_LUT_ADD_TRANS
See Also:
Constant Field Values

POST_PALETTE_TO_RGB

private static final int POST_PALETTE_TO_RGB
See Also:
Constant Field Values

POST_PALETTE_TO_RGBA

private static final int POST_PALETTE_TO_RGBA
See Also:
Constant Field Values

POST_ADD_GRAY_TRANS

private static final int POST_ADD_GRAY_TRANS
See Also:
Constant Field Values

POST_ADD_RGB_TRANS

private static final int POST_ADD_RGB_TRANS
See Also:
Constant Field Values

POST_REMOVE_GRAY_TRANS

private static final int POST_REMOVE_GRAY_TRANS
See Also:
Constant Field Values

POST_REMOVE_RGB_TRANS

private static final int POST_REMOVE_RGB_TRANS
See Also:
Constant Field Values

POST_EXP_MASK

private static final int POST_EXP_MASK
See Also:
Constant Field Values

POST_GRAY_ALPHA_EXP

private static final int POST_GRAY_ALPHA_EXP
See Also:
Constant Field Values

POST_GAMMA_EXP

private static final int POST_GAMMA_EXP
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

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

hasBackground

private boolean hasBackground

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

decodeParam

private PNGDecodeParam decodeParam

encodeParam

private PNGEncodeParam encodeParam

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

streamVec

private java.util.Vector 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.Vector textKeys

textStrings

private java.util.Vector textStrings

ztextKeys

private java.util.Vector ztextKeys

ztextStrings

private java.util.Vector ztextStrings

theTile

private java.awt.image.WritableRaster theTile

gammaLut

private int[] gammaLut

expandBits

private final byte[][] expandBits

grayLut

private int[] grayLut
Constructor Detail

PNGImage

public PNGImage(java.io.InputStream stream,
                PNGDecodeParam decodeParam)
         throws java.io.IOException
Constructor for the PNGImage object

Method Detail

getChunkType

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

readChunk

private static PNGChunk readChunk(java.io.DataInputStream distream)

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)

getTile

public java.awt.image.Raster getTile(int tileX,
                                     int tileY)
Gets the Tile attribute of the PNGImage object


initGammaLut

private void initGammaLut(int bits)

initGrayLut

private void initGrayLut(int bits)

parse_IHDR_chunk

private void parse_IHDR_chunk(PNGChunk chunk)

parse_IEND_chunk

private void parse_IEND_chunk(PNGChunk chunk)
                       throws java.lang.Exception

parse_PLTE_chunk

private void parse_PLTE_chunk(PNGChunk chunk)

parse_bKGD_chunk

private void parse_bKGD_chunk(PNGChunk chunk)

parse_cHRM_chunk

private void parse_cHRM_chunk(PNGChunk chunk)

parse_gAMA_chunk

private void parse_gAMA_chunk(PNGChunk chunk)

parse_hIST_chunk

private void parse_hIST_chunk(PNGChunk chunk)

parse_iCCP_chunk

private void parse_iCCP_chunk(PNGChunk chunk)

parse_pHYs_chunk

private void parse_pHYs_chunk(PNGChunk chunk)

parse_sBIT_chunk

private void parse_sBIT_chunk(PNGChunk chunk)

parse_sRGB_chunk

private void parse_sRGB_chunk(PNGChunk chunk)

parse_tEXt_chunk

private void parse_tEXt_chunk(PNGChunk chunk)

parse_tIME_chunk

private void parse_tIME_chunk(PNGChunk chunk)

parse_tRNS_chunk

private void parse_tRNS_chunk(PNGChunk chunk)

parse_zTXt_chunk

private void parse_zTXt_chunk(PNGChunk chunk)

createRaster

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

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)