org.jmol.export.image
public class PngEncoder extends Object
Version: 1.4, 31 March 2000
Field Summary | |
---|---|
protected int | bytePos |
protected int | bytesPerPixel |
protected int | compressionLevel |
protected CRC32 | crc |
protected long | crcValue |
protected int | dataPos |
protected boolean | encodeAlpha |
protected int | endPos |
static boolean | ENCODE_ALPHA Constant specifying that alpha channel should be encoded. |
protected int | filter |
static int | FILTER_LAST |
static int | FILTER_NONE Constants for filters |
static int | FILTER_SUB |
static int | FILTER_UP |
protected int | hdrPos |
protected int | height |
protected Image | image |
protected byte[] | leftBytes |
protected int | maxPos |
static boolean | NO_ALPHA Constant specifying that alpha channel should not be encoded. |
protected byte[] | pngBytes |
protected byte[] | priorRow |
protected int | width |
Constructor Summary | |
---|---|
PngEncoder()
Class constructor
| |
PngEncoder(Image image)
Class constructor specifying Image to encode, with no alpha channel encoding.
| |
PngEncoder(Image image, boolean encodeAlpha)
Class constructor specifying Image to encode, and whether to encode alpha.
| |
PngEncoder(Image image, boolean encodeAlpha, int whichFilter)
Class constructor specifying Image to encode, whether to encode alpha, and filter to use.
| |
PngEncoder(Image image, boolean encodeAlpha, int whichFilter, int compLevel)
Class constructor specifying Image source to encode, whether to encode alpha, filter to use, and compression level.
|
Method Summary | |
---|---|
protected void | filterSub(byte[] pixels, int startPos, int width)
Perform "sub" filtering on the given row.
|
protected void | filterUp(byte[] pixels, int startPos, int width)
Perform "up" filtering on the given row.
|
int | getCompressionLevel()
Retrieve compression level
|
boolean | getEncodeAlpha()
Retrieve alpha encoding status.
|
int | getFilter()
Retrieve filtering scheme
|
byte[] | pngEncode(boolean encodeAlpha)
Creates an array of bytes that is the PNG equivalent of the current image, specifying whether to encode alpha or not.
|
byte[] | pngEncode()
Creates an array of bytes that is the PNG equivalent of the current image.
|
protected byte[] | resizeByteArray(byte[] array, int newLength)
Increase or decrease the length of a byte array.
|
void | setCompressionLevel(int level)
Set the compression level to use
|
void | setEncodeAlpha(boolean encodeAlpha)
Set the alpha encoding on or off.
|
void | setFilter(int whichFilter)
Set the filter to use
|
void | setImage(Image image)
Set the image to be encoded
|
protected int | writeByte(int b, int offset)
Write a single byte into the pngBytes array at a given position.
|
protected int | writeBytes(byte[] data, int offset)
Write an array of bytes into the pngBytes array.
|
protected int | writeBytes(byte[] data, int nBytes, int offset)
Write an array of bytes into the pngBytes array, specifying number of bytes to write.
|
protected void | writeEnd()
Write a PNG "IEND" chunk into the pngBytes array. |
protected void | writeHeader()
Write a PNG "IHDR" chunk into the pngBytes array. |
protected boolean | writeImageData()
Write the image data into the pngBytes array.
|
protected int | writeInt2(int n, int offset)
Write a two-byte integer into the pngBytes array at a given position.
|
protected int | writeInt4(int n, int offset)
Write a four-byte integer into the pngBytes array at a given position.
|
protected int | writeString(String s, int offset)
Write a string into the pngBytes array at a given position.
|
Parameters: image A Java Image object which uses the DirectColorModel
See Also: java.awt.Image
Parameters: image A Java Image object which uses the DirectColorModel encodeAlpha Encode the alpha channel? false=no; true=yes
See Also: java.awt.Image
Parameters: image A Java Image object which uses the DirectColorModel encodeAlpha Encode the alpha channel? false=no; true=yes whichFilter 0=none, 1=sub, 2=up
See Also: java.awt.Image
Parameters: image A Java Image object encodeAlpha Encode the alpha channel? false=no; true=yes whichFilter 0=none, 1=sub, 2=up compLevel 0..9
See Also: java.awt.Image
Parameters: pixels The array holding the scan lines being built startPos Starting position within pixels of bytes to be filtered. width Width of a scanline in pixels.
Parameters: pixels The array holding the scan lines being built startPos Starting position within pixels of bytes to be filtered. width Width of a scanline in pixels.
Returns: int in range 0-9
Returns: boolean false=no, true=yes
Returns: int (see constant list)
Parameters: encodeAlpha boolean false=no alpha, true=encode alpha
Returns: an array of bytes, or null if there was a problem
Returns: an array of bytes, or null if there was a problem
Parameters: array The original array. newLength The length you wish the new array to have.
Returns: Array of newly desired length. If shorter than the original, the trailing elements are truncated.
Parameters: level 0 through 9
Parameters: encodeAlpha false=no, true=yes
Parameters: whichFilter from constant list
Parameters: image A Java Image object which uses the DirectColorModel
See Also: java.awt.Image java.awt.image.DirectColorModel
Parameters: b The byte to be written into pngBytes. offset The starting point to write to.
Returns: The next place to be written to in the pngBytes array.
Parameters: data The data to be written into pngBytes. offset The starting point to write to.
Returns: The next place to be written to in the pngBytes array.
Parameters: data The data to be written into pngBytes. nBytes The number of bytes to be written. offset The starting point to write to.
Returns: The next place to be written to in the pngBytes array.
Returns: true if no errors; false if error grabbing pixels
Parameters: n The integer to be written into pngBytes. offset The starting point to write to.
Returns: The next place to be written to in the pngBytes array.
Parameters: n The integer to be written into pngBytes. offset The starting point to write to.
Returns: The next place to be written to in the pngBytes array.
Parameters: s The string to be written into pngBytes. offset The starting point to write to.
Returns: The next place to be written to in the pngBytes array.
See Also: java.lang.String#getBytes()