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 int
private int
private byte[]
private int
private int
private boolean
private byte[]
private DataOutputStream
private byte[][]
private byte[]
private int
private RenderedImage
private boolean
private static final Logger
private static final byte[]
private int
protected OutputStream
The OutputStream associcted with this ImageEncoder.private mxPngEncodeParam
private static final int
private static final int
private static final int
private static final int
private static final int
private byte[]
private byte[]
private boolean
private static final float[]
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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.void
encode
(RenderedImage im) This method encodes aRenderedImage
into PNG.private void
encodePass
(OutputStream os, Raster ras, int xOffset, int yOffset, int xSkip, int ySkip) Returns the OutputStream associated with this ImageEncoder.getParam()
void
setParam
(mxPngEncodeParam param) private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private 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 aRenderedImage
into 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
-