public class PngEncoder extends CRCEncoder
Modifier and Type | Field and Description |
---|---|
private byte[] |
applicationData |
private String |
applicationPrefix |
private int |
bytesPerPixel |
private int |
byteWidth |
private int |
compressionLevel |
private boolean |
encodeAlpha |
private int |
filter |
static int |
FILTER_LAST |
static int |
FILTER_NONE
Constants for filters
|
static int |
FILTER_SUB |
static int |
FILTER_UP |
private byte[] |
scanLines |
private Integer |
transparentColor |
private String |
type |
private String |
version |
bytePos, dataLen, pngBytes, startPos
Constructor and Description |
---|
PngEncoder() |
Modifier and Type | Method and Description |
---|---|
protected void |
generate() |
private static String |
getApplicationText(String prefix,
String type,
int nPNG,
int nState) |
private boolean |
pngEncode(int[] ptAppTag)
Creates an array of bytes that is the PNG equivalent of the current image,
specifying whether to encode alpha or not.
|
private static void |
setJmolTypeText(String prefix,
int ptJmolByteText,
byte[] b,
int nPNG,
int nState,
String type)
Fill in the Jmol type text area with number of bytes of PNG data and number
of bytes of Jmol state data and fix checksum.
|
protected void |
setParams(Map<String,Object> params) |
private void |
writeEnd()
Write a PNG "IEND" chunk into the pngBytes array.
|
private void |
writeHeader()
Write a PNG "IHDR" chunk into the pngBytes array.
|
private boolean |
writeImageData()
Write the image data into the pngBytes array.
|
private void |
writeText(String msg) |
private void |
writeTransparentColor(int icolor)
Write a PNG "tRNS" chunk into the pngBytes array.
|
getBytes, getInt4, setData, writeByte, writeBytes, writeCRC, writeInt2, writeInt4, writeString
close, createImage, encodeImage, putByte, putString
public static final int FILTER_NONE
public static final int FILTER_SUB
public static final int FILTER_UP
public static final int FILTER_LAST
private boolean encodeAlpha
private int filter
private int bytesPerPixel
private int compressionLevel
private String type
private Integer transparentColor
private byte[] applicationData
private String applicationPrefix
private String version
private byte[] scanLines
private int byteWidth
protected void setParams(Map<String,Object> params)
setParams
in class ImageEncoder
protected void generate() throws IOException
generate
in class ImageEncoder
IOException
private boolean pngEncode(int[] ptAppTag)
ptAppTag
- private static void setJmolTypeText(String prefix, int ptJmolByteText, byte[] b, int nPNG, int nState, String type)
prefix
- ptJmolByteText
- b
- nPNG
- nState
- type
- private static String getApplicationText(String prefix, String type, int nPNG, int nState)
private void writeHeader()
private void writeText(String msg)
private void writeTransparentColor(int icolor)
icolor
- private boolean writeImageData()
private void writeEnd()