java.lang.Object
org.ydp.jai.ImageEncoderImpl
org.ydp.jai.PNGImageEncoder
- All Implemented Interfaces:
- ImageEncoder
- public class PNGImageEncoder
- extends ImageEncoderImpl
An ImageEncoder for the PNG file format.
|
Method Summary |
private static int |
clamp(int val,
int maxValue)
|
private PNGEncodeParam.Gray |
createGrayParam(byte[] redPalette,
byte[] greenPalette,
byte[] bluePalette,
byte[] alphaPalette)
Analyzes a set of palettes and determines if it can be expressed
as a standard set of gray values, with zero or one values being
fully transparent and the rest being fully opaque. |
void |
encode(java.awt.image.RenderedImage im)
Encodes a RenderedImage and writes the output to the
OutputStream associated with this ImageEncoder. |
private void |
encodePass(java.io.OutputStream os,
java.awt.image.Raster ras,
int xOffset,
int yOffset,
int xSkip,
int ySkip)
|
private void |
writeBKGD()
|
private void |
writeCHRM()
|
private void |
writeGAMA()
|
private void |
writeHIST()
|
private void |
writeICCP()
|
private void |
writeIDAT()
|
private void |
writeIEND()
|
private void |
writeIHDR()
|
private void |
writeMagic()
|
private void |
writePHYS()
|
private void |
writePLTE()
|
private void |
writePrivateChunks()
|
private void |
writeSBIT()
|
private void |
writeSPLT()
|
private void |
writeSRGB()
|
private void |
writeTEXT()
|
private void |
writeTIME()
|
private void |
writeTRNS()
|
private void |
writeZTXT()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PNG_COLOR_GRAY
private static final int PNG_COLOR_GRAY
- See Also:
- Constant Field Values
PNG_COLOR_RGB
private static final int PNG_COLOR_RGB
- See Also:
- Constant Field Values
PNG_COLOR_PALETTE
private static final int PNG_COLOR_PALETTE
- See Also:
- Constant Field Values
PNG_COLOR_GRAY_ALPHA
private static final int PNG_COLOR_GRAY_ALPHA
- See Also:
- Constant Field Values
PNG_COLOR_RGB_ALPHA
private static final int PNG_COLOR_RGB_ALPHA
- See Also:
- Constant Field Values
magic
private static final byte[] magic
param
private PNGEncodeParam param
image
private java.awt.image.RenderedImage image
width
private int width
height
private int height
bitDepth
private int bitDepth
bitShift
private int bitShift
numBands
private int numBands
colorType
private int colorType
bpp
private int bpp
skipAlpha
private boolean skipAlpha
compressGray
private boolean compressGray
interlace
private boolean interlace
redPalette
private byte[] redPalette
greenPalette
private byte[] greenPalette
bluePalette
private byte[] bluePalette
alphaPalette
private byte[] alphaPalette
dataOutput
private java.io.DataOutputStream dataOutput
prevRow
private byte[] prevRow
currRow
private byte[] currRow
filteredRows
private byte[][] filteredRows
srgbChroma
private static final float[] srgbChroma
expandBits
private final byte[][] expandBits
PNGImageEncoder
public PNGImageEncoder(java.io.OutputStream output,
PNGEncodeParam param)
writeMagic
private void writeMagic()
throws java.io.IOException
writeIHDR
private void writeIHDR()
throws java.io.IOException
clamp
private static int clamp(int val,
int maxValue)
encodePass
private void encodePass(java.io.OutputStream os,
java.awt.image.Raster ras,
int xOffset,
int yOffset,
int xSkip,
int ySkip)
throws java.io.IOException
writeIDAT
private void writeIDAT()
throws java.io.IOException
writeIEND
private void writeIEND()
throws java.io.IOException
writeCHRM
private void writeCHRM()
throws java.io.IOException
writeGAMA
private void writeGAMA()
throws java.io.IOException
writeICCP
private void writeICCP()
throws java.io.IOException
writeSBIT
private void writeSBIT()
throws java.io.IOException
writeSRGB
private void writeSRGB()
throws java.io.IOException
writePLTE
private void writePLTE()
throws java.io.IOException
writeBKGD
private void writeBKGD()
throws java.io.IOException
writeHIST
private void writeHIST()
throws java.io.IOException
writeTRNS
private void writeTRNS()
throws java.io.IOException
writePHYS
private void writePHYS()
throws java.io.IOException
writeSPLT
private void writeSPLT()
throws java.io.IOException
writeTIME
private void writeTIME()
throws java.io.IOException
writeTEXT
private void writeTEXT()
throws java.io.IOException
writeZTXT
private void writeZTXT()
throws java.io.IOException
writePrivateChunks
private void writePrivateChunks()
throws java.io.IOException
createGrayParam
private PNGEncodeParam.Gray createGrayParam(byte[] redPalette,
byte[] greenPalette,
byte[] bluePalette,
byte[] alphaPalette)
- Analyzes a set of palettes and determines if it can be expressed
as a standard set of gray values, with zero or one values being
fully transparent and the rest being fully opaque. If it
is possible to express the data thusly, the method returns
a suitable instance of PNGEncodeParam.Gray; otherwise it
returns null.
encode
public void encode(java.awt.image.RenderedImage im)
throws java.io.IOException
- Description copied from class:
ImageEncoderImpl
- Encodes a RenderedImage and writes the output to the
OutputStream associated with this ImageEncoder.
- Specified by:
encode in interface ImageEncoder- Specified by:
encode in class ImageEncoderImpl