public class GIFImageLoader2 extends ImageLoaderImpl
Modifier and Type | Class and Description |
---|---|
(package private) class |
GIFImageLoader2.LZWDecoder |
Modifier and Type | Field and Description |
---|---|
(package private) int |
bgColor |
(package private) static int |
DEFAULT_FPS |
(package private) static byte[] |
FILE_SIG87 |
(package private) static byte[] |
FILE_SIG89 |
(package private) byte[][] |
globalPalette |
(package private) byte[] |
image |
(package private) int |
loopCount |
(package private) static byte[] |
NETSCAPE_SIG |
(package private) int |
screenH |
(package private) int |
screenW |
(package private) java.io.InputStream |
stream |
formatDescription, lastPercentDone, listeners
Constructor and Description |
---|
GIFImageLoader2(java.io.InputStream input) |
Modifier and Type | Method and Description |
---|---|
private int[] |
computeInterlaceReIndex(int h) |
private void |
consumeAnExtension() |
private void |
decodeImage(byte[] image,
int w,
int h,
int[] interlace) |
private java.nio.ByteBuffer |
decodePalette(byte[] srcImage,
byte[][] palette,
int trnsIndex,
int left,
int top,
int w,
int h,
int disposalCode) |
void |
dispose()
Disposes of any resources (such as native libraries) held by this loader.
|
ImageFrame |
load(int imageIndex,
int width,
int height,
boolean preserveAspectRatio,
boolean smooth)
Loads the image at a given index in an image stream.
|
private void |
readAppExtension() |
private int |
readByte() |
private byte[] |
readBytes(byte[] data) |
private byte[] |
readBytes(byte[] data,
int offs,
int size) |
private int |
readControlCode() |
private void |
readGlobalHeader() |
private byte[][] |
readPalete(int size,
int trnsIndex) |
private int |
readShort() |
private void |
restoreToBackground(byte[] img,
int left,
int top,
int w,
int h) |
private void |
skipBytes(int n) |
private ImageMetadata |
updateMetadata(int w,
int h,
int delayTime) |
private int |
waitForImageFrame() |
addListener, emitWarning, getFormatDescription, removeListener, updateImageMetadata, updateImageProgress
static final byte[] FILE_SIG87
static final byte[] FILE_SIG89
static final byte[] NETSCAPE_SIG
static final int DEFAULT_FPS
java.io.InputStream stream
int screenW
int screenH
int bgColor
byte[][] globalPalette
byte[] image
int loopCount
public GIFImageLoader2(java.io.InputStream input) throws java.io.IOException
java.io.IOException
private void readGlobalHeader() throws java.io.IOException
java.io.IOException
private byte[][] readPalete(int size, int trnsIndex) throws java.io.IOException
java.io.IOException
private void consumeAnExtension() throws java.io.IOException
java.io.IOException
private void readAppExtension() throws java.io.IOException
java.io.IOException
private int readControlCode() throws java.io.IOException
java.io.IOException
private int waitForImageFrame() throws java.io.IOException
java.io.IOException
private void decodeImage(byte[] image, int w, int h, int[] interlace) throws java.io.IOException
java.io.IOException
private int[] computeInterlaceReIndex(int h)
public ImageFrame load(int imageIndex, int width, int height, boolean preserveAspectRatio, boolean smooth) throws java.io.IOException
ImageLoader
null
will be returned.imageIndex
- the zero-relative index of the image to load.width
- the desired image width. If non-positive,
an IllegalArgumentException
will be thrown.height
- 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
private int readByte() throws java.io.IOException
java.io.IOException
private int readShort() 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 skipBytes(int n) throws java.io.IOException
java.io.IOException
public void dispose()
ImageLoader
private void restoreToBackground(byte[] img, int left, int top, int w, int h)
private java.nio.ByteBuffer decodePalette(byte[] srcImage, byte[][] palette, int trnsIndex, int left, int top, int w, int h, int disposalCode)
private ImageMetadata updateMetadata(int w, int h, int delayTime)