org.apache.batik.ext.awt.image.codec.png

Class PNGEncodeParam.Gray

public static class PNGEncodeParam.Gray extends PNGEncodeParam

Constructor Summary
Gray()
Constructs an instance of PNGEncodeParam.Gray.
Method Summary
intgetBackgroundGray()
Returns the suggested gray level of the background.
intgetBitShift()
Returns the desired bit shift for a grayscale image.
intgetTransparentGray()
Returns the gray value to be used to denote transparency.
booleanisBackgroundSet()
Returns true if a 'bKGD' chunk will be output.
booleanisBitDepthSet()
Returns true if the bit depth has been set.
booleanisBitShiftSet()
Returns true if the bit shift has been set.
voidsetBackgroundGray(int gray)
Sets the suggested gray level of the background.
voidsetBitDepth(int bitDepth)
Sets the desired bit depth for a grayscale image.
voidsetBitShift(int bitShift)
Sets the desired bit shift for a grayscale image.
voidsetTransparentGray(int transparentGray)
Sets the gray value to be used to denote transparency.
voidunsetBackground()
Suppresses the 'bKGD' chunk from being output.
voidunsetBitShift()
Suppresses the setting of the bit shift of a grayscale image.

Constructor Detail

Gray

public Gray()
Constructs an instance of PNGEncodeParam.Gray.

Method Detail

getBackgroundGray

public int getBackgroundGray()
Returns the suggested gray level of the background.

If the background gray level has not previously been set, or has been unset, an IllegalStateException will be thrown.

Throws: IllegalStateException if the background gray level is not set.

getBitShift

public int getBitShift()
Returns the desired bit shift for a grayscale image.

If the bit shift has not previously been set, or has been unset, an IllegalStateException will be thrown.

Throws: IllegalStateException if the bit shift is not set.

getTransparentGray

public int getTransparentGray()
Returns the gray value to be used to denote transparency.

If the transparent gray value has not previously been set, or has been unset, an IllegalStateException will be thrown.

Throws: IllegalStateException if the transparent gray value is not set.

isBackgroundSet

public boolean isBackgroundSet()
Returns true if a 'bKGD' chunk will be output.

isBitDepthSet

public boolean isBitDepthSet()
Returns true if the bit depth has been set.

isBitShiftSet

public boolean isBitShiftSet()
Returns true if the bit shift has been set.

setBackgroundGray

public void setBackgroundGray(int gray)
Sets the suggested gray level of the background.

The 'bKGD' chunk will encode this information.

setBitDepth

public void setBitDepth(int bitDepth)
Sets the desired bit depth for a grayscale image. The bit depth must be one of 1, 2, 4, 8, or 16.

When encoding a source image of a greater bit depth, pixel values will be clamped to the smaller range after shifting by the value given by getBitShift(). When encoding a source image of a smaller bit depth, pixel values will be shifted and left-filled with zeroes.

setBitShift

public void setBitShift(int bitShift)
Sets the desired bit shift for a grayscale image. Pixels in the source image will be shifted right by the given amount prior to being clamped to the maximum value given by the encoded image's bit depth.

setTransparentGray

public void setTransparentGray(int transparentGray)
Sets the gray value to be used to denote transparency.

Setting this attribute will cause the alpha channel of the input image to be ignored.

The 'tRNS' chunk will encode this information.

unsetBackground

public void unsetBackground()
Suppresses the 'bKGD' chunk from being output.

unsetBitShift

public void unsetBitShift()
Suppresses the setting of the bit shift of a grayscale image. Pixels in the source image will not be shifted prior to encoding.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.