public class GifDecoder extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
STATUS_FORMAT_ERROR
File read status: Error decoding file (may be partially decoded)
|
static int |
STATUS_OK
File read status: No errors.
|
static int |
STATUS_OPEN_ERROR
File read status: Unable to open source.
|
| Constructor and Description |
|---|
GifDecoder() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
decodeImageData()
Decodes LZW image data into pixel array.
|
protected boolean |
err()
Returns whether or not an error was encountered during reading/decoding.
|
BufferedImage |
getCurrentBufImg()
Gets the first (or only) image read.
|
int |
getDelay(int n)
Gets display duration for specified frame.
|
BufferedImage |
getFrame(int n)
Gets the image contents of frame n.
|
int |
getFrameCount()
Gets the number of frames read from file.
|
int |
getLoopCount()
Gets the "Netscape" iteration count, if any.
|
int |
getPixelAspect()
Returns pixel aspect ratio.
|
int |
getStatus()
Returns decoder status.
|
protected void |
init()
Initializes or re-initializes reader
|
protected int |
read()
Reads a single byte from the input stream.
|
int |
read(BufferedInputStream is) |
int |
read(String name)
Reads GIF file from specified source (file or URL string)
|
protected int |
readBlock()
Reads next variable length block from input.
|
protected int[] |
readColorTable(int ncolors)
Reads color table as 256 RGB integer values
|
protected void |
readContents()
Main file parser.
|
protected void |
readGraphicControlExt()
Reads Graphics Control Extension values
|
protected void |
readHeader()
Reads GIF file header information.
|
protected void |
readImage()
Reads next frame image
|
protected void |
readLSD()
Reads Logical Screen Descriptor
|
protected void |
readNetscapeExt()
Reads Netscape extension to obtain iteration count
|
protected int |
readShort()
Reads next 16-bit value, LSB first.
|
protected void |
resetFrame()
Resets frame state for reading next image.
|
protected void |
setPixels()
Creates new frame image from current data (and previous frames as specified by their
disposition codes).
|
protected void |
skip()
Skips variable length blocks up to and including next zero length block.
|
public static final int STATUS_OK
public static final int STATUS_FORMAT_ERROR
public static final int STATUS_OPEN_ERROR
public int getPixelAspect()
public int getDelay(int n)
n - int index of framepublic BufferedImage getFrame(int n)
n - frame numberBufferedImage representation of frame, or null if n is invalidpublic int getFrameCount()
public BufferedImage getCurrentBufImg()
public int getLoopCount()
public int read(BufferedInputStream is)
is - An inputStream with gif animationpublic int read(String name)
name - String containing sourceprotected void decodeImageData()
protected boolean err()
true if an error was encountered during reading/decoding, false otherwiseprotected void init()
protected int read()
protected int readBlock()
protected int[] readColorTable(int ncolors)
ncolors - int number of colors to readprotected void readContents()
protected void readGraphicControlExt()
protected void readHeader()
protected void readImage()
protected void readLSD()
protected void readNetscapeExt()
protected int readShort()
protected void resetFrame()
protected void setPixels()
protected void skip()
public int getStatus()
Copyright © 2020. All rights reserved.