public final class PNGImageLoader2 extends ImageLoaderImpl
Modifier and Type | Field and Description |
---|---|
private int |
bitDepth |
private int |
colorType |
(package private) static byte[] |
FILE_SIG |
private int |
height |
(package private) static int |
IDAT_TYPE |
(package private) static int |
IEND_TYPE |
(package private) static int |
IHDR_TYPE |
private static int[] |
increment_x |
private static int[] |
increment_y |
private boolean |
isInterlaced |
(package private) static int[] |
numBandsPerColorType |
private byte[][] |
palette |
(package private) static int |
PLTE_TYPE |
(package private) static int |
PNG_COLOR_GRAY |
(package private) static int |
PNG_COLOR_GRAY_ALPHA |
(package private) static int |
PNG_COLOR_PALETTE |
(package private) static int |
PNG_COLOR_RGB |
(package private) static int |
PNG_COLOR_RGB_ALPHA |
(package private) static int |
PNG_FILTER_AVERAGE |
(package private) static int |
PNG_FILTER_NONE |
(package private) static int |
PNG_FILTER_PAETH |
(package private) static int |
PNG_FILTER_SUB |
(package private) static int |
PNG_FILTER_UP |
private static int[] |
starting_x |
private static int[] |
starting_y |
private java.io.DataInputStream |
stream |
private boolean |
tRNS_GRAY_RGB |
private boolean |
tRNS_present |
(package private) static int |
tRNS_TYPE |
private int |
trnsB |
private int |
trnsG |
private int |
trnsR |
private int |
width |
formatDescription, lastPercentDone, listeners
Constructor and Description |
---|
PNGImageLoader2(java.io.InputStream input) |
Modifier and Type | Method and Description |
---|---|
private int |
bpp() |
private int |
bytesPerColor() |
private void |
copy_plain(byte[] line,
byte[] image,
int pos,
int step,
int bpp) |
private void |
copy(byte[] line,
byte[] image,
int pos,
int step,
int resultBpp) |
private void |
copyTrns_gray(byte[] line,
byte[] image,
int pos,
int step) |
private void |
copyTrns_rgb(byte[] line,
byte[] image,
int pos,
int step) |
private ImageFrame |
decodePalette(byte[] srcImage,
ImageMetadata metadata) |
void |
dispose()
Disposes of any resources (such as native libraries) held by this loader.
|
private void |
doAvrgFilter(byte[] line,
byte[] pline,
int bpp) |
private void |
doFilter(byte[] line,
byte[] pline,
int fType,
int bpp) |
private void |
doPaethFilter(byte[] line,
byte[] pline,
int bpp) |
private void |
doSubFilter(byte[] line,
int bpp) |
private void |
doUpFilter(byte[] line,
byte[] pline) |
private void |
downsample16to8_plain(byte[] line,
byte[] image,
int pos,
int step,
int bpp) |
private void |
downsample16to8(byte[] line,
byte[] image,
int pos,
int step,
int bpp) |
private void |
downsample16to8trns_gray(byte[] line,
byte[] image,
int pos,
int step) |
private void |
downsample16to8trns_rgb(byte[] line,
byte[] image,
int pos,
int step) |
private ImageStorage.ImageType |
getType() |
private void |
load(byte[] image,
java.io.InputStream data) |
ImageFrame |
load(int imageIndex,
int rWidth,
int rHeight,
boolean preserveAspectRatio,
boolean smooth)
Loads the image at a given index in an image stream.
|
private void |
loadMip(byte[] image,
java.io.InputStream data,
int mip) |
private static int |
mipPos(int pos,
int mip,
int[] start,
int[] increment) |
private static int |
mipSize(int size,
int mip,
int[] start,
int[] increment) |
private static int |
paethPr(int a,
int b,
int c) |
private void |
parsePaletteChunk(int chunkLength) |
private int |
parsePngMeta() |
private void |
parseTransparencyChunk(int chunkLength) |
private byte[] |
readBytes(byte[] data) |
private byte[] |
readBytes(byte[] data,
int offs,
int size) |
private int[] |
readChunk() |
private boolean |
readGrayTransparency(int chunkLength) |
private void |
readHeader() |
private void |
readPaletteChunk(int chunkLength) |
private boolean |
readPaletteTransparency(int chunkLength) |
private boolean |
readRgbTransparency(int chunkLength) |
private void |
skip(int n) |
private void |
upsampleTo8(byte[] line,
byte[] image,
int pos,
int w,
int step,
int bpp) |
private void |
upsampleTo8Gray(byte[] line,
byte[] image,
int pos,
int w,
int step) |
private void |
upsampleTo8GrayTrns(byte[] line,
byte[] image,
int pos,
int w,
int step) |
private void |
upsampleTo8Palette(byte[] line,
byte[] image,
int pos,
int w,
int step) |
addListener, emitWarning, getFormatDescription, removeListener, updateImageMetadata, updateImageProgress
static final byte[] FILE_SIG
static final int IHDR_TYPE
static final int PLTE_TYPE
static final int IDAT_TYPE
static final int IEND_TYPE
static final int tRNS_TYPE
static final int PNG_COLOR_GRAY
static final int PNG_COLOR_RGB
static final int PNG_COLOR_PALETTE
static final int PNG_COLOR_GRAY_ALPHA
static final int PNG_COLOR_RGB_ALPHA
static final int[] numBandsPerColorType
static final int PNG_FILTER_NONE
static final int PNG_FILTER_SUB
static final int PNG_FILTER_UP
static final int PNG_FILTER_AVERAGE
static final int PNG_FILTER_PAETH
private final java.io.DataInputStream stream
private int width
private int height
private int bitDepth
private int colorType
private boolean isInterlaced
private boolean tRNS_present
private boolean tRNS_GRAY_RGB
private int trnsR
private int trnsG
private int trnsB
private byte[][] palette
private static final int[] starting_y
private static final int[] starting_x
private static final int[] increment_y
private static final int[] increment_x
public PNGImageLoader2(java.io.InputStream input) throws java.io.IOException
java.io.IOException
private void readHeader() throws java.io.IOException
java.io.IOException
private int[] readChunk() throws java.io.IOException
java.io.IOException
private byte[] readBytes(byte[] data) throws java.io.IOException
java.io.IOException
private byte[] readBytes(byte[] data, int offs, int size) throws java.io.IOException
java.io.IOException
private void skip(int n) throws java.io.IOException
java.io.IOException
private void readPaletteChunk(int chunkLength) throws java.io.IOException
java.io.IOException
private void parsePaletteChunk(int chunkLength) throws java.io.IOException
java.io.IOException
private boolean readPaletteTransparency(int chunkLength) throws java.io.IOException
java.io.IOException
private boolean readGrayTransparency(int chunkLength) throws java.io.IOException
java.io.IOException
private boolean readRgbTransparency(int chunkLength) throws java.io.IOException
java.io.IOException
private void parseTransparencyChunk(int chunkLength) throws java.io.IOException
java.io.IOException
private int parsePngMeta() throws java.io.IOException
java.io.IOException
public void dispose()
ImageLoader
private ImageStorage.ImageType getType()
private void doSubFilter(byte[] line, int bpp)
private void doUpFilter(byte[] line, byte[] pline)
private void doAvrgFilter(byte[] line, byte[] pline, int bpp)
private static int paethPr(int a, int b, int c)
private void doPaethFilter(byte[] line, byte[] pline, int bpp)
private void doFilter(byte[] line, byte[] pline, int fType, int bpp)
private void downsample16to8trns_gray(byte[] line, byte[] image, int pos, int step)
private void downsample16to8trns_rgb(byte[] line, byte[] image, int pos, int step)
private void downsample16to8_plain(byte[] line, byte[] image, int pos, int step, int bpp)
private void downsample16to8(byte[] line, byte[] image, int pos, int step, int bpp)
private void copyTrns_gray(byte[] line, byte[] image, int pos, int step)
private void copyTrns_rgb(byte[] line, byte[] image, int pos, int step)
private void copy_plain(byte[] line, byte[] image, int pos, int step, int bpp)
private void copy(byte[] line, byte[] image, int pos, int step, int resultBpp)
private void upsampleTo8Palette(byte[] line, byte[] image, int pos, int w, int step)
private void upsampleTo8Gray(byte[] line, byte[] image, int pos, int w, int step)
private void upsampleTo8GrayTrns(byte[] line, byte[] image, int pos, int w, int step)
private void upsampleTo8(byte[] line, byte[] image, int pos, int w, int step, int bpp)
private static int mipSize(int size, int mip, int[] start, int[] increment)
private static int mipPos(int pos, int mip, int[] start, int[] increment)
private void loadMip(byte[] image, java.io.InputStream data, int mip) throws java.io.IOException
java.io.IOException
private void load(byte[] image, java.io.InputStream data) throws java.io.IOException
java.io.IOException
private ImageFrame decodePalette(byte[] srcImage, ImageMetadata metadata)
private int bpp()
private int bytesPerColor()
public ImageFrame load(int imageIndex, int rWidth, int rHeight, boolean preserveAspectRatio, boolean smooth) throws java.io.IOException
ImageLoader
null
will be returned.imageIndex
- the zero-relative index of the image to load.rWidth
- the desired image width. If non-positive,
an IllegalArgumentException
will be thrown.rHeight
- the desired image height. If non-positive,
an IllegalArgumentException
will be thrown.preserveAspectRatio
- whether to preserve the width-to-height ratio
of the image.smooth
- whether to use a smooth downscaling algorithm.null
on error.java.io.IOException