Class PNGEncodeParam
- java.lang.Object
-
- org.apache.batik.ext.awt.image.codec.png.PNGEncodeParam
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,ImageDecodeParam,ImageEncodeParam
- Direct Known Subclasses:
PNGEncodeParam.Gray,PNGEncodeParam.Palette,PNGEncodeParam.RGB
public abstract class PNGEncodeParam extends java.lang.Object implements ImageEncodeParam
An instance ofImageEncodeParamfor encoding images in the PNG format.This class is not a committed part of the JAI API. It may be removed or changed in future releases of JAI.
- Version:
- $Id: PNGEncodeParam.java 1831630 2018-05-15 12:56:55Z ssteiner $
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPNGEncodeParam.Graystatic classPNGEncodeParam.Palettestatic classPNGEncodeParam.RGB
-
Field Summary
Fields Modifier and Type Field Description protected intbitDepthprotected booleanbitDepthSetprivate float[]chromaticityprivate booleanchromaticitySet(package private) java.util.ListchunkData(package private) java.util.ListchunkTypeprivate floatgammaprivate booleangammaSetprivate byte[]ICCProfileDataprivate booleanICCProfileDataSetstatic intINTENT_ABSOLUTEConstant for use with the sRGB chunk.static intINTENT_PERCEPTUALConstant for use with the sRGB chunk.static intINTENT_RELATIVEConstant for use with the sRGB chunk.static intINTENT_SATURATIONConstant for use with the sRGB chunk.private java.util.DatemodificationTimeprivate booleanmodificationTimeSetprivate int[]paletteHistogramprivate booleanpaletteHistogramSetprivate int[]physicalDimensionprivate booleanphysicalDimensionSetstatic intPNG_FILTER_AVERAGEConstant for use in filtering.static intPNG_FILTER_NONEConstant for use in filtering.static intPNG_FILTER_PAETHConstant for use in filtering.static intPNG_FILTER_SUBConstant for use in filtering.static intPNG_FILTER_UPConstant for use in filtering.private int[]significantBitsprivate booleansignificantBitsSetprivate intSRGBIntentprivate booleanSRGBIntentSetprivate PNGSuggestedPaletteEntry[]suggestedPaletteprivate booleansuggestedPaletteSetprivate java.lang.String[]textprivate booleantextSet(package private) booleantransparencySetprivate booleanuseInterlacingprivate java.lang.String[]zTextprivate booleanzTextSet
-
Constructor Summary
Constructors Constructor Description PNGEncodeParam()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static intabs(int x)An abs() function for use by the Paeth predictor.voidaddPrivateChunk(java.lang.String type, byte[] data)Adds a private chunk, in binary form, to the list of chunks to be stored with this image.intfilterRow(byte[] currRow, byte[] prevRow, byte[][] scratchRows, int bytesPerRow, int bytesPerPixel)Performs filtering on a row of an image.intgetBitDepth()Returns the desired bit depth for a grayscale image.float[]getChromaticity()Returns the white point and primary chromaticities in CIE (x, y) space.java.lang.String[]getCompressedText()Returns the text strings to be stored in compressed form with this image as an array ofStrings.static PNGEncodeParamgetDefaultEncodeParam(java.awt.image.RenderedImage im)Returns an instance ofPNGEncodeParam.Palette,PNGEncodeParam.Gray, orPNGEncodeParam.RGBappropriate for encoding the given image.floatgetGamma()Returns the file gamma value for the image.byte[]getICCProfileData()Returns the ICC profile data to be stored with this image.booleangetInterlacing()Returnstrueif Adam7 interlacing will be used.java.util.DategetModificationTime()Returns the modification time to be stored with this image.intgetNumPrivateChunks()Returns the number of private chunks to be written to the output file.int[]getPaletteHistogram()Returns the palette histogram to be stored with this image.int[]getPhysicalDimension()Returns the physical dimension information to be stored with this image.byte[]getPrivateChunkData(int index)Returns the data associated of the private chunk at a given index, as an array ofbytes.java.lang.StringgetPrivateChunkType(int index)Returns the type of the private chunk at a given index, as a 4-characterString.int[]getSignificantBits()Returns the number of significant bits for each band of the image.intgetSRGBIntent()Returns the sRGB rendering intent to be stored with this image.PNGSuggestedPaletteEntry[]getSuggestedPalette()Returns the suggested palette information to be stored with this image.java.lang.String[]getText()Returns the text strings to be stored in uncompressed form with this image as an array ofStrings.booleanisBackgroundSet()Returns true if a 'bKGD' chunk will be output.booleanisChromaticitySet()Returns true if a 'cHRM' chunk will be output.booleanisCompressedTextSet()Returns true if a 'zTXT' chunk will be output.booleanisGammaSet()Returns true if a 'gAMA' chunk will be output.booleanisICCProfileDataSet()Returns true if a 'iCCP' chunk will be output.booleanisModificationTimeSet()Returns true if a 'tIME' chunk will be output.booleanisPaletteHistogramSet()Returns true if a 'hIST' chunk will be output.booleanisPhysicalDimensionSet()Returns true if a 'pHYS' chunk will be output.booleanisSignificantBitsSet()Returns true if an 'sBIT' chunk will be output.booleanisSRGBIntentSet()Returns true if an 'sRGB' chunk will be output.booleanisSuggestedPaletteSet()Returns true if a 'sPLT' chunk will be output.booleanisTextSet()Returns true if a 'tEXt' chunk will be output.booleanisTransparencySet()Returns true if a 'tRNS' chunk will be output.static intpaethPredictor(int a, int b, int c)The Paeth predictor routine used in PNG encoding.voidremoveAllPrivateChunks()Remove all private chunks associated with this parameter instance.voidremoveUnsafeToCopyPrivateChunks()Remove all private chunks associated with this parameter instance whose 'safe-to-copy' bit is not set.abstract voidsetBitDepth(int bitDepth)Sets the desired bit depth of an image.voidsetChromaticity(float[] chromaticity)Sets the white point and primary chromaticities in CIE (x, y) space.voidsetChromaticity(float whitePointX, float whitePointY, float redX, float redY, float greenX, float greenY, float blueX, float blueY)A convenience method that calls the array version.voidsetCompressedText(java.lang.String[] text)Sets the text strings to be stored in compressed form with this image.voidsetGamma(float gamma)Sets the file gamma value for the image.voidsetICCProfileData(byte[] ICCProfileData)Sets the ICC profile data to be stored with this image.voidsetInterlacing(boolean useInterlacing)Turns Adam7 interlacing on or off.voidsetModificationTime(java.util.Date modificationTime)Sets the modification time, as aDate, to be stored with this image.voidsetPaletteHistogram(int[] paletteHistogram)Sets the palette histogram to be stored with this image.voidsetPhysicalDimension(int[] physicalDimension)Sets the physical dimension information to be stored with this image.voidsetPhysicalDimension(int xPixelsPerUnit, int yPixelsPerUnit, int unitSpecifier)A convenience method that calls the array version.voidsetSignificantBits(int[] significantBits)Sets the number of significant bits for each band of the image.voidsetSRGBIntent(int SRGBIntent)Sets the sRGB rendering intent to be stored with this image.voidsetSuggestedPalette(PNGSuggestedPaletteEntry[] palette)Sets the suggested palette information to be stored with this image.voidsetText(java.lang.String[] text)Sets the textual data to be stored in uncompressed form with this image.voidunsetBackground()Suppresses the 'bKGD' chunk from being output.voidunsetBitDepth()Suppresses the setting of the bit depth of a grayscale image.voidunsetChromaticity()Suppresses the 'cHRM' chunk from being output.voidunsetCompressedText()Suppresses the 'zTXt' chunk from being output.voidunsetGamma()Suppresses the 'gAMA' chunk from being output.voidunsetICCProfileData()Suppresses the 'iCCP' chunk from being output.voidunsetModificationTime()Suppresses the 'tIME' chunk from being output.voidunsetPaletteHistogram()Suppresses the 'hIST' chunk from being output.voidunsetPhysicalDimension()Suppresses the 'pHYS' chunk from being output.voidunsetSignificantBits()Suppresses the 'sBIT' chunk from being output.voidunsetSRGBIntent()Suppresses the 'sRGB' chunk from being output.voidunsetSuggestedPalette()Suppresses the 'sPLT' chunk from being output.voidunsetText()Suppresses the 'tEXt' chunk from being output.voidunsetTransparency()Suppresses the 'tRNS' chunk from being output.
-
-
-
Field Detail
-
INTENT_PERCEPTUAL
public static final int INTENT_PERCEPTUAL
Constant for use with the sRGB chunk.- See Also:
- Constant Field Values
-
INTENT_RELATIVE
public static final int INTENT_RELATIVE
Constant for use with the sRGB chunk.- See Also:
- Constant Field Values
-
INTENT_SATURATION
public static final int INTENT_SATURATION
Constant for use with the sRGB chunk.- See Also:
- Constant Field Values
-
INTENT_ABSOLUTE
public static final int INTENT_ABSOLUTE
Constant for use with the sRGB chunk.- See Also:
- Constant Field Values
-
PNG_FILTER_NONE
public static final int PNG_FILTER_NONE
Constant for use in filtering.- See Also:
- Constant Field Values
-
PNG_FILTER_SUB
public static final int PNG_FILTER_SUB
Constant for use in filtering.- See Also:
- Constant Field Values
-
PNG_FILTER_UP
public static final int PNG_FILTER_UP
Constant for use in filtering.- See Also:
- Constant Field Values
-
PNG_FILTER_AVERAGE
public static final int PNG_FILTER_AVERAGE
Constant for use in filtering.- See Also:
- Constant Field Values
-
PNG_FILTER_PAETH
public static final int PNG_FILTER_PAETH
Constant for use in filtering.- See Also:
- Constant Field Values
-
bitDepth
protected int bitDepth
-
bitDepthSet
protected boolean bitDepthSet
-
useInterlacing
private boolean useInterlacing
-
chromaticity
private float[] chromaticity
-
chromaticitySet
private boolean chromaticitySet
-
gamma
private float gamma
-
gammaSet
private boolean gammaSet
-
paletteHistogram
private int[] paletteHistogram
-
paletteHistogramSet
private boolean paletteHistogramSet
-
ICCProfileData
private byte[] ICCProfileData
-
ICCProfileDataSet
private boolean ICCProfileDataSet
-
physicalDimension
private int[] physicalDimension
-
physicalDimensionSet
private boolean physicalDimensionSet
-
suggestedPalette
private PNGSuggestedPaletteEntry[] suggestedPalette
-
suggestedPaletteSet
private boolean suggestedPaletteSet
-
significantBits
private int[] significantBits
-
significantBitsSet
private boolean significantBitsSet
-
SRGBIntent
private int SRGBIntent
-
SRGBIntentSet
private boolean SRGBIntentSet
-
text
private java.lang.String[] text
-
textSet
private boolean textSet
-
modificationTime
private java.util.Date modificationTime
-
modificationTimeSet
private boolean modificationTimeSet
-
transparencySet
boolean transparencySet
-
zText
private java.lang.String[] zText
-
zTextSet
private boolean zTextSet
-
chunkType
java.util.List chunkType
-
chunkData
java.util.List chunkData
-
-
Method Detail
-
getDefaultEncodeParam
public static PNGEncodeParam getDefaultEncodeParam(java.awt.image.RenderedImage im)
Returns an instance ofPNGEncodeParam.Palette,PNGEncodeParam.Gray, orPNGEncodeParam.RGBappropriate for encoding the given image.If the image has an
IndexColorModel, an instance ofPNGEncodeParam.Paletteis returned. Otherwise, if the image has 1 or 2 bands an instance ofPNGEncodeParam.Grayis returned. In all other cases an instance ofPNGEncodeParam.RGBis returned.Note that this method does not provide any guarantee that the given image will be successfully encoded by the PNG encoder, as it only performs a very superficial analysis of the image structure.
-
setBitDepth
public abstract void setBitDepth(int bitDepth)
Sets the desired bit depth of an image.
-
getBitDepth
public int getBitDepth()
Returns the desired bit depth for a grayscale image.If the bit depth has not previously been set, or has been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the bit depth is not set.
-
unsetBitDepth
public void unsetBitDepth()
Suppresses the setting of the bit depth of a grayscale image. The depth of the encoded image will be inferred from the source image bit depth, rounded up to the next power of 2 between 1 and 16.
-
setInterlacing
public void setInterlacing(boolean useInterlacing)
Turns Adam7 interlacing on or off.
-
getInterlacing
public boolean getInterlacing()
Returnstrueif Adam7 interlacing will be used.
-
unsetBackground
public void unsetBackground()
Suppresses the 'bKGD' chunk from being output. For API compatibility with JAI 1.0, the superclass defines this method to throw aRuntimeException; accordingly, subclasses must provide their own implementations.
-
isBackgroundSet
public boolean isBackgroundSet()
Returns true if a 'bKGD' chunk will be output. For API compatibility with JAI 1.0, the superclass defines this method to throw aRuntimeException; accordingly, subclasses must provide their own implementations.
-
setChromaticity
public void setChromaticity(float[] chromaticity)
Sets the white point and primary chromaticities in CIE (x, y) space.The
chromaticityparameter should be afloatarray of length 8 containing the white point X and Y, red X and Y, green X and Y, and blue X and Y values in order.The 'cHRM' chunk will encode this information.
-
setChromaticity
public void setChromaticity(float whitePointX, float whitePointY, float redX, float redY, float greenX, float greenY, float blueX, float blueY)A convenience method that calls the array version.
-
getChromaticity
public float[] getChromaticity()
Returns the white point and primary chromaticities in CIE (x, y) space.See the documentation for the
setChromaticitymethod for the format of the returned data.If the chromaticity has not previously been set, or has been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the chromaticity is not set.
-
unsetChromaticity
public void unsetChromaticity()
Suppresses the 'cHRM' chunk from being output.
-
isChromaticitySet
public boolean isChromaticitySet()
Returns true if a 'cHRM' chunk will be output.
-
setGamma
public void setGamma(float gamma)
Sets the file gamma value for the image.The 'gAMA' chunk will encode this information.
-
getGamma
public float getGamma()
Returns the file gamma value for the image.If the file gamma has not previously been set, or has been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the gamma is not set.
-
unsetGamma
public void unsetGamma()
Suppresses the 'gAMA' chunk from being output.
-
isGammaSet
public boolean isGammaSet()
Returns true if a 'gAMA' chunk will be output.
-
setPaletteHistogram
public void setPaletteHistogram(int[] paletteHistogram)
Sets the palette histogram to be stored with this image. The histogram consists of an array of integers, one per palette entry.The 'hIST' chunk will encode this information.
-
getPaletteHistogram
public int[] getPaletteHistogram()
Returns the palette histogram to be stored with this image.If the histogram has not previously been set, or has been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the histogram is not set.
-
unsetPaletteHistogram
public void unsetPaletteHistogram()
Suppresses the 'hIST' chunk from being output.
-
isPaletteHistogramSet
public boolean isPaletteHistogramSet()
Returns true if a 'hIST' chunk will be output.
-
setICCProfileData
public void setICCProfileData(byte[] ICCProfileData)
Sets the ICC profile data to be stored with this image. The profile is represented in raw binary form.The 'iCCP' chunk will encode this information.
-
getICCProfileData
public byte[] getICCProfileData()
Returns the ICC profile data to be stored with this image.If the ICC profile has not previously been set, or has been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the ICC profile is not set.
-
unsetICCProfileData
public void unsetICCProfileData()
Suppresses the 'iCCP' chunk from being output.
-
isICCProfileDataSet
public boolean isICCProfileDataSet()
Returns true if a 'iCCP' chunk will be output.
-
setPhysicalDimension
public void setPhysicalDimension(int[] physicalDimension)
Sets the physical dimension information to be stored with this image. The physicalDimension parameter should be a 3-entry array containing the number of pixels per unit in the X direction, the number of pixels per unit in the Y direction, and the unit specifier (0 = unknown, 1 = meters).The 'pHYS' chunk will encode this information.
-
setPhysicalDimension
public void setPhysicalDimension(int xPixelsPerUnit, int yPixelsPerUnit, int unitSpecifier)A convenience method that calls the array version.
-
getPhysicalDimension
public int[] getPhysicalDimension()
Returns the physical dimension information to be stored with this image.If the physical dimension information has not previously been set, or has been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the physical dimension information is not set.
-
unsetPhysicalDimension
public void unsetPhysicalDimension()
Suppresses the 'pHYS' chunk from being output.
-
isPhysicalDimensionSet
public boolean isPhysicalDimensionSet()
Returns true if a 'pHYS' chunk will be output.
-
setSuggestedPalette
public void setSuggestedPalette(PNGSuggestedPaletteEntry[] palette)
Sets the suggested palette information to be stored with this image. The information is passed to this method as an array ofPNGSuggestedPaletteEntryobjects.The 'sPLT' chunk will encode this information.
-
getSuggestedPalette
public PNGSuggestedPaletteEntry[] getSuggestedPalette()
Returns the suggested palette information to be stored with this image.If the suggested palette information has not previously been set, or has been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the suggested palette information is not set.
-
unsetSuggestedPalette
public void unsetSuggestedPalette()
Suppresses the 'sPLT' chunk from being output.
-
isSuggestedPaletteSet
public boolean isSuggestedPaletteSet()
Returns true if a 'sPLT' chunk will be output.
-
setSignificantBits
public void setSignificantBits(int[] significantBits)
Sets the number of significant bits for each band of the image.The number of entries in the
significantBitsarray must be equal to the number of output bands in the image: 1 for a gray image, 2 for gray+alpha, 3 for index or truecolor, and 4 for truecolor+alpha.The 'sBIT' chunk will encode this information.
-
getSignificantBits
public int[] getSignificantBits()
Returns the number of significant bits for each band of the image.If the significant bits values have not previously been set, or have been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the significant bits values are not set.
-
unsetSignificantBits
public void unsetSignificantBits()
Suppresses the 'sBIT' chunk from being output.
-
isSignificantBitsSet
public boolean isSignificantBitsSet()
Returns true if an 'sBIT' chunk will be output.
-
setSRGBIntent
public void setSRGBIntent(int SRGBIntent)
Sets the sRGB rendering intent to be stored with this image. The legal values are 0 = Perceptual, 1 = Relative Colorimetric, 2 = Saturation, and 3 = Absolute Colorimetric. Refer to the PNG specification for information on these values.The 'sRGB' chunk will encode this information.
-
getSRGBIntent
public int getSRGBIntent()
Returns the sRGB rendering intent to be stored with this image.If the sRGB intent has not previously been set, or has been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the sRGB intent is not set.
-
unsetSRGBIntent
public void unsetSRGBIntent()
Suppresses the 'sRGB' chunk from being output.
-
isSRGBIntentSet
public boolean isSRGBIntentSet()
Returns true if an 'sRGB' chunk will be output.
-
setText
public void setText(java.lang.String[] text)
Sets the textual data to be stored in uncompressed form with this image. The data is passed to this method as an array ofStrings.The 'tEXt' chunk will encode this information.
-
getText
public java.lang.String[] getText()
Returns the text strings to be stored in uncompressed form with this image as an array ofStrings.If the text strings have not previously been set, or have been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the text strings are not set.
-
unsetText
public void unsetText()
Suppresses the 'tEXt' chunk from being output.
-
isTextSet
public boolean isTextSet()
Returns true if a 'tEXt' chunk will be output.
-
setModificationTime
public void setModificationTime(java.util.Date modificationTime)
Sets the modification time, as aDate, to be stored with this image. The internal storage format will use UTC regardless of how themodificationTimeparameter was created.The 'tIME' chunk will encode this information.
-
getModificationTime
public java.util.Date getModificationTime()
Returns the modification time to be stored with this image.If the bit depth has not previously been set, or has been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the bit depth is not set.
-
unsetModificationTime
public void unsetModificationTime()
Suppresses the 'tIME' chunk from being output.
-
isModificationTimeSet
public boolean isModificationTimeSet()
Returns true if a 'tIME' chunk will be output.
-
unsetTransparency
public void unsetTransparency()
Suppresses the 'tRNS' chunk from being output.
-
isTransparencySet
public boolean isTransparencySet()
Returns true if a 'tRNS' chunk will be output.
-
setCompressedText
public void setCompressedText(java.lang.String[] text)
Sets the text strings to be stored in compressed form with this image. The data is passed to this method as an array ofStrings.The 'zTXt' chunk will encode this information.
-
getCompressedText
public java.lang.String[] getCompressedText()
Returns the text strings to be stored in compressed form with this image as an array ofStrings.If the compressed text strings have not previously been set, or have been unset, an
IllegalStateExceptionwill be thrown.- Throws:
java.lang.IllegalStateException- if the compressed text strings are not set.
-
unsetCompressedText
public void unsetCompressedText()
Suppresses the 'zTXt' chunk from being output.
-
isCompressedTextSet
public boolean isCompressedTextSet()
Returns true if a 'zTXT' chunk will be output.
-
addPrivateChunk
public void addPrivateChunk(java.lang.String type, byte[] data)Adds a private chunk, in binary form, to the list of chunks to be stored with this image.- Parameters:
type- a 4-character String giving the chunk type name.data- an array ofbytes containing the chunk data.
-
getNumPrivateChunks
public int getNumPrivateChunks()
Returns the number of private chunks to be written to the output file.
-
getPrivateChunkType
public java.lang.String getPrivateChunkType(int index)
Returns the type of the private chunk at a given index, as a 4-characterString. The index must be smaller than the return value ofgetNumPrivateChunks.
-
getPrivateChunkData
public byte[] getPrivateChunkData(int index)
Returns the data associated of the private chunk at a given index, as an array ofbytes. The index must be smaller than the return value ofgetNumPrivateChunks.
-
removeUnsafeToCopyPrivateChunks
public void removeUnsafeToCopyPrivateChunks()
Remove all private chunks associated with this parameter instance whose 'safe-to-copy' bit is not set. This may be advisable when transcoding PNG images.
-
removeAllPrivateChunks
public void removeAllPrivateChunks()
Remove all private chunks associated with this parameter instance.
-
abs
private static final int abs(int x)
An abs() function for use by the Paeth predictor.
-
paethPredictor
public static final int paethPredictor(int a, int b, int c)The Paeth predictor routine used in PNG encoding. This routine is included as a convenience to subclasses that override thefilterRowmethod.
-
filterRow
public int filterRow(byte[] currRow, byte[] prevRow, byte[][] scratchRows, int bytesPerRow, int bytesPerPixel)Performs filtering on a row of an image. This method may be overridden in order to provide a custom algorithm for choosing the filter type for a given row.The method is supplied with the current and previous rows of the image. For the first row of the image, or of an interlacing pass, the previous row array will be filled with zeros as required by the PNG specification.
The method is also supplied with five scratch arrays. These arrays may be used within the method for any purpose. At method exit, the array at the index given by the return value of the method should contain the filtered data. The return value will also be used as the filter type.
The default implementation of the method performs a trial encoding with each of the filter types, and computes the sum of absolute values of the differences between the raw bytes of the current row and the predicted values. The index of the filter producing the smallest result is returned.
As an example, to perform only 'sub' filtering, this method could be implemented (non-optimally) as follows:
for (int i = bytesPerPixel; i < bytesPerRow + bytesPerPixel; i++) { int curr = currRow[i] & 0xff; int left = currRow[i - bytesPerPixel] & 0xff; scratchRow[PNG_FILTER_SUB][i] = (byte)(curr - left); } return PNG_FILTER_SUB;- Parameters:
currRow- The current row as an array ofbytes of length at leastbytesPerRow + bytesPerPixel. The pixel data starts at indexbytesPerPixel; the initialbytesPerPixelbytes are zero.prevRow- The current row as an array ofbytes The pixel data starts at indexbytesPerPixel; the initialbytesPerPixelbytes are zero.scratchRows- An array of 5bytearrays of length at leastbytesPerRow + bytesPerPixel, useable to hold temporary results. The filtered row will be returned as one of the entries of this array. The returned filtered data should start at indexbytesPerPixel; The initialbytesPerPixelbytes are not used.bytesPerRow- The number of bytes in the image row. This value will always be greater than 0.bytesPerPixel- The number of bytes representing a single pixel, rounded up to an integer. This is the 'bpp' parameter described in the PNG specification.- Returns:
- The filter type to be used. The entry of
scratchRows[]at this index holds the filtered data.
-
-