public class GenericPngEncoder extends GenericCRCEncoder
Modifier and Type | Field and Description |
---|---|
private ApiPlatform |
apiPlatform |
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 int |
height |
private java.lang.Object |
image |
private byte[] |
scanLines |
private java.lang.Integer |
transparentColor |
private java.lang.String |
type |
private int |
width |
bytePos, startPos
Constructor and Description |
---|
GenericPngEncoder(ApiPlatform apiPlatform,
java.lang.Object image,
boolean encodeAlpha,
int whichFilter,
int compLevel)
Class constructor specifying Image source to encode, whether to encode
alpha, filter to use, and compression level.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
getBytesType(ApiPlatform apiPlatform,
java.lang.Object image,
int quality,
int bgcolor,
java.lang.String type,
int[] ptJmol) |
private static java.lang.String |
getJmolTypeText(java.lang.String type,
int nPNG,
int nState) |
private byte[] |
pngEncode(int[] ptJmol)
Creates an array of bytes that is the PNG equivalent of the current image,
specifying whether to encode alpha or not.
|
static void |
setJmolTypeText(int ptJmolByteText,
byte[] b,
int nPNG,
int nState,
java.lang.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.
|
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(java.lang.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
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 java.lang.Object image
private int width
private int height
private boolean encodeAlpha
private int filter
private int bytesPerPixel
private int compressionLevel
private java.lang.String type
private java.lang.Integer transparentColor
private ApiPlatform apiPlatform
private byte[] scanLines
private int byteWidth
public GenericPngEncoder(ApiPlatform apiPlatform, java.lang.Object image, boolean encodeAlpha, int whichFilter, int compLevel)
apiPlatform
- platform-dependent image processingimage
- A Java Image objectencodeAlpha
- Encode the alpha channel? false=no; true=yes (Jmol - not used)whichFilter
- 0=none, 1=sub, 2=up (Jmol only uses NONE)compLevel
- 0..9Image
public static byte[] getBytesType(ApiPlatform apiPlatform, java.lang.Object image, int quality, int bgcolor, java.lang.String type, int[] ptJmol)
private byte[] pngEncode(int[] ptJmol)
ptJmol
- public static void setJmolTypeText(int ptJmolByteText, byte[] b, int nPNG, int nState, java.lang.String type)
ptJmolByteText
- b
- nPNG
- nState
- type
- private static java.lang.String getJmolTypeText(java.lang.String type, int nPNG, int nState)
private void writeHeader()
private void writeText(java.lang.String msg)
private void writeTransparentColor(int icolor)
icolor
- private boolean writeImageData()
private void writeEnd()