org.apache.batik.ext.awt.image.codec.png
Class PNGEncodeParam.Gray

java.lang.Object
  extended by org.apache.batik.ext.awt.image.codec.png.PNGEncodeParam
      extended by org.apache.batik.ext.awt.image.codec.png.PNGEncodeParam.Gray
All Implemented Interfaces:
Serializable, Cloneable, ImageDecodeParam, ImageEncodeParam
Enclosing class:
PNGEncodeParam

public static class PNGEncodeParam.Gray
extends PNGEncodeParam

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.batik.ext.awt.image.codec.png.PNGEncodeParam
PNGEncodeParam.Gray, PNGEncodeParam.Palette, PNGEncodeParam.RGB
 
Field Summary
 
Fields inherited from class org.apache.batik.ext.awt.image.codec.png.PNGEncodeParam
bitDepth, bitDepthSet, INTENT_ABSOLUTE, INTENT_PERCEPTUAL, INTENT_RELATIVE, INTENT_SATURATION, PNG_FILTER_AVERAGE, PNG_FILTER_NONE, PNG_FILTER_PAETH, PNG_FILTER_SUB, PNG_FILTER_UP
 
Constructor Summary
PNGEncodeParam.Gray()
          Constructs an instance of PNGEncodeParam.Gray.
 
Method Summary
 int getBackgroundGray()
          Returns the suggested gray level of the background.
 int getBitShift()
          Returns the desired bit shift for a grayscale image.
 int getTransparentGray()
          Returns the gray value to be used to denote transparency.
 boolean isBackgroundSet()
          Returns true if a 'bKGD' chunk will be output.
 boolean isBitDepthSet()
          Returns true if the bit depth has been set.
 boolean isBitShiftSet()
          Returns true if the bit shift has been set.
 void setBackgroundGray(int gray)
          Sets the suggested gray level of the background.
 void setBitDepth(int bitDepth)
          Sets the desired bit depth for a grayscale image.
 void setBitShift(int bitShift)
          Sets the desired bit shift for a grayscale image.
 void setTransparentGray(int transparentGray)
          Sets the gray value to be used to denote transparency.
 void unsetBackground()
          Suppresses the 'bKGD' chunk from being output.
 void unsetBitShift()
          Suppresses the setting of the bit shift of a grayscale image.
 
Methods inherited from class org.apache.batik.ext.awt.image.codec.png.PNGEncodeParam
addPrivateChunk, filterRow, getBitDepth, getChromaticity, getCompressedText, getDefaultEncodeParam, getGamma, getICCProfileData, getInterlacing, getModificationTime, getNumPrivateChunks, getPaletteHistogram, getPhysicalDimension, getPrivateChunkData, getPrivateChunkType, getSignificantBits, getSRGBIntent, getSuggestedPalette, getText, isChromaticitySet, isCompressedTextSet, isGammaSet, isICCProfileDataSet, isModificationTimeSet, isPaletteHistogramSet, isPhysicalDimensionSet, isSignificantBitsSet, isSRGBIntentSet, isSuggestedPaletteSet, isTextSet, isTransparencySet, paethPredictor, removeAllPrivateChunks, removeUnsafeToCopyPrivateChunks, setChromaticity, setChromaticity, setCompressedText, setGamma, setICCProfileData, setInterlacing, setModificationTime, setPaletteHistogram, setPhysicalDimension, setPhysicalDimension, setSignificantBits, setSRGBIntent, setSuggestedPalette, setText, unsetBitDepth, unsetChromaticity, unsetCompressedText, unsetGamma, unsetICCProfileData, unsetModificationTime, unsetPaletteHistogram, unsetPhysicalDimension, unsetSignificantBits, unsetSRGBIntent, unsetSuggestedPalette, unsetText, unsetTransparency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PNGEncodeParam.Gray

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

Method Detail

unsetBackground

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

Overrides:
unsetBackground in class PNGEncodeParam

isBackgroundSet

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

Overrides:
isBackgroundSet in class PNGEncodeParam

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.

Specified by:
setBitDepth in class PNGEncodeParam

setBackgroundGray

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

The 'bKGD' chunk will encode this information.


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.

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.


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.

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.


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.

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.


isBitShiftSet

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


isBitDepthSet

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



Copyright © 2008 Apache Software Foundation. All Rights Reserved.