public final class PNGFileFormat extends FileFormat
Modifier and Type | Field and Description |
---|---|
(package private) int |
adler |
(package private) byte[] |
alphaPalette |
(package private) byte[] |
data |
(package private) byte |
headerByte1 |
(package private) byte |
headerByte2 |
(package private) PngIhdrChunk |
headerChunk |
(package private) ImageData |
imageData |
(package private) PngPlteChunk |
paletteChunk |
(package private) static int |
PRIME |
(package private) static int |
SIGNATURE_LENGTH |
compression, FORMAT_PACKAGE, FORMAT_SUFFIX, FORMATS, inputStream, loader, outputStream
Constructor and Description |
---|
PNGFileFormat() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
compress16BitDepthTo8BitDepth(byte[] source,
int sourceOffset,
byte[] destination,
int destinationOffset,
int numberOfValues)
SWT does not support 16-bit depth color formats.
|
(package private) static int |
compress16BitDepthTo8BitDepth(int value)
SWT does not support 16-bit depth color formats.
|
(package private) void |
filterRow(byte[] row,
byte[] previousRow,
int filterType)
PNG supports four filtering types.
|
(package private) void |
fireInterlacedFrameEvent(int frameCount)
Fire an event to let listeners know that an interlaced
frame has been loaded.
|
(package private) int |
getAlignedBytesPerRow()
Answer the number of bytes in a word-aligned row of pixel data.
|
(package private) int |
getBytesPerPixel()
Answer the number of bytes needed to represent a pixel.
|
(package private) int |
getBytesPerRow()
Answer the number of bytes in each row of the image
data.
|
(package private) int |
getBytesPerRow(int rowWidthInPixels)
Answer the number of bytes in a row of the given pixel
width.
|
(package private) boolean |
isFileFormat(LEDataInputStream stream)
Return whether or not the specified input stream
represents a supported file format.
|
(package private) ImageData[] |
loadFromByteStream()
Load the PNG image from the byte stream.
|
(package private) void |
readInterlacedImage(java.io.InputStream inputStream)
Read the pixel data for an interlaced image from the
data stream.
|
(package private) void |
readInterlaceFrame(java.io.InputStream inputStream,
int rowInterval,
int columnInterval,
int startRow,
int startColumn,
int frameCount)
1.
|
(package private) void |
readNextChunk(PngChunkReader chunkReader)
Read and handle the next chunk of data from the
PNG file.
|
(package private) void |
readNonInterlacedImage(java.io.InputStream inputStream)
Read the pixel data for a non-interlaced image from the
data stream.
|
(package private) void |
readPixelData(PngIdatChunk chunk,
PngChunkReader chunkReader)
Read the image data from the data stream.
|
(package private) void |
readSignature()
Skip over signature data.
|
(package private) void |
setImageDataValues(byte[] data,
ImageData imageData)
PNG supports some color types and bit depths that are
unsupported by SWT.
|
(package private) void |
setPixelData(byte[] data,
ImageData imageData)
SWT does not support greyscale as a color type.
|
(package private) void |
unloadIntoByteStream(ImageLoader loader) |
(package private) byte[] |
validateBitDepth(byte[] data)
SWT does not support 16-bit depths.
|
load, loadFromStream, save, unloadIntoStream
static final int SIGNATURE_LENGTH
static final int PRIME
PngIhdrChunk headerChunk
PngPlteChunk paletteChunk
ImageData imageData
byte[] data
byte[] alphaPalette
byte headerByte1
byte headerByte2
int adler
void readSignature() throws java.io.IOException
java.io.IOException
ImageData[] loadFromByteStream()
loadFromByteStream
in class FileFormat
void readNextChunk(PngChunkReader chunkReader) throws java.io.IOException
java.io.IOException
void unloadIntoByteStream(ImageLoader loader)
unloadIntoByteStream
in class FileFormat
boolean isFileFormat(LEDataInputStream stream)
FileFormat
isFileFormat
in class FileFormat
byte[] validateBitDepth(byte[] data)
void setPixelData(byte[] data, ImageData imageData)
void setImageDataValues(byte[] data, ImageData imageData)
void readPixelData(PngIdatChunk chunk, PngChunkReader chunkReader) throws java.io.IOException
java.io.IOException
int getAlignedBytesPerRow()
int getBytesPerRow()
int getBytesPerPixel()
int getBytesPerRow(int rowWidthInPixels)
void readInterlaceFrame(java.io.InputStream inputStream, int rowInterval, int columnInterval, int startRow, int startColumn, int frameCount) throws java.io.IOException
java.io.IOException
void readInterlacedImage(java.io.InputStream inputStream) throws java.io.IOException
java.io.IOException
void fireInterlacedFrameEvent(int frameCount)
void readNonInterlacedImage(java.io.InputStream inputStream) throws java.io.IOException
java.io.IOException
static void compress16BitDepthTo8BitDepth(byte[] source, int sourceOffset, byte[] destination, int destinationOffset, int numberOfValues)
static int compress16BitDepthTo8BitDepth(int value)
void filterRow(byte[] row, byte[] previousRow, int filterType)