Package com.mxgraph.util.png
Class mxPngImageEncoder
java.lang.Object
com.mxgraph.util.png.mxPngImageEncoder
An ImageEncoder for the PNG file format.
- Since:
- EA4
- Version:
- $Id: mxPngImageEncoder.java,v 1.1 2012/11/15 13:26:39 gaudenz Exp $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]private intprivate intprivate byte[]private intprivate intprivate booleanprivate byte[]private DataOutputStreamprivate byte[][]private byte[]private intprivate RenderedImageprivate booleanprivate static final Loggerprivate static final byte[]private intprotected OutputStreamThe OutputStream associcted with this ImageEncoder.private mxPngEncodeParamprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate byte[]private byte[]private booleanprivate static final float[]private int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate mxPngEncodeParam.GraycreateGrayParam(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.voidencode(RenderedImage im) This method encodes aRenderedImageinto PNG.private voidencodePass(OutputStream os, Raster ras, int xOffset, int yOffset, int xSkip, int ySkip) Returns the OutputStream associated with this ImageEncoder.getParam()voidsetParam(mxPngEncodeParam param) private voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate void
-
Field Details
-
log
-
PNG_COLOR_GRAY
private static final int PNG_COLOR_GRAY- See Also:
-
PNG_COLOR_RGB
private static final int PNG_COLOR_RGB- See Also:
-
PNG_COLOR_PALETTE
private static final int PNG_COLOR_PALETTE- See Also:
-
PNG_COLOR_GRAY_ALPHA
private static final int PNG_COLOR_GRAY_ALPHA- See Also:
-
PNG_COLOR_RGB_ALPHA
private static final int PNG_COLOR_RGB_ALPHA- See Also:
-
magic
private static final byte[] magic -
param
-
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
-
output
The OutputStream associcted with this ImageEncoder. -
prevRow
private byte[] prevRow -
currRow
private byte[] currRow -
filteredRows
private byte[][] filteredRows -
srgbChroma
private static final float[] srgbChroma
-
-
Constructor Details
-
mxPngImageEncoder
-
-
Method Details
-
getParam
-
setParam
-
getOutputStream
Returns the OutputStream associated with this ImageEncoder. -
writeMagic
- Throws:
IOException
-
writeIHDR
- Throws:
IOException
-
encodePass
private void encodePass(OutputStream os, Raster ras, int xOffset, int yOffset, int xSkip, int ySkip) throws IOException - Throws:
IOException
-
writeIDAT
- Throws:
IOException
-
writeIEND
- Throws:
IOException
-
writeCHRM
- Throws:
IOException
-
writeGAMA
- Throws:
IOException
-
writeICCP
- Throws:
IOException
-
writeSBIT
- Throws:
IOException
-
writeSRGB
- Throws:
IOException
-
writePLTE
- Throws:
IOException
-
writeBKGD
- Throws:
IOException
-
writeHIST
- Throws:
IOException
-
writeTRNS
- Throws:
IOException
-
writePHYS
- Throws:
IOException
-
writeSPLT
- Throws:
IOException
-
writeTIME
- Throws:
IOException
-
writeTEXT
- Throws:
IOException
-
writeZTXT
- Throws:
IOException
-
writePrivateChunks
- Throws:
IOException
-
createGrayParam
private mxPngEncodeParam.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
This method encodes aRenderedImageinto PNG. The stream into which the PNG is dumped is not closed at the end of the operation, this should be done if needed by the caller of this method.- Throws:
IOException
-