|
GeneThello Home | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.fmsware.gif.GifDecoder
public class GifDecoder
Class GifDecoder - Decodes a GIF file into one or more frames.
Example:
GifDecoder d = new GifDecoder();
d.read("sample.gif");
int n = d.getFrameCount();
for (int i = 0; i < n; i++) {
Image frame = d.getFrame(i); // frame i
int t = d.getDelay(i); // display duration of frame in milliseconds
// do something with frame
}
No copyright asserted on the source code of this class. May be used for
any purpose, however, refer to the Unisys LZW patent for any additional
restrictions. Please forward any corrections to kweiner@fmsware.com.
| Field Summary | |
|---|---|
protected int[] |
act
|
protected int |
bgColor
|
protected int |
bgIndex
|
protected byte[] |
block
|
protected int |
blockSize
|
protected int |
delay
|
protected int |
dispose
|
protected int |
frameCount
|
protected java.util.Vector |
frames
|
protected int[] |
gct
|
protected boolean |
gctFlag
|
protected int |
gctSize
|
protected int |
height
|
protected int |
ih
|
protected int[] |
image
|
protected java.io.BufferedInputStream |
in
|
protected boolean |
interlace
|
protected int |
iw
|
protected int |
ix
|
protected int |
iy
|
protected int |
lastBgColor
|
protected int |
lastDispose
|
protected int[] |
lastImage
|
protected java.awt.Rectangle |
lastRect
|
protected int[] |
lct
|
protected boolean |
lctFlag
|
protected int |
lctSize
|
protected int |
loopCount
|
protected static int |
MaxStackSize
|
protected int |
pixelAspect
|
protected byte[] |
pixels
|
protected byte[] |
pixelStack
|
protected short[] |
prefix
|
protected int |
status
|
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. |
protected byte[] |
suffix
|
protected int |
transIndex
|
protected boolean |
transparency
|
protected int |
width
|
| Constructor Summary | |
|---|---|
GifDecoder()
|
|
| Method Summary | |
|---|---|
protected void |
decodeImageData()
Decodes LZW image data into pixel array. |
static int |
encodeColor(java.awt.Color c)
|
static int |
encodeColor(int r,
int g,
int b)
|
protected boolean |
err()
Returns true if an error was encountered during reading/decoding |
int |
getDelay(int n)
Gets display duration for specified frame. |
java.awt.Image |
getFrame(int n)
Gets the image contents of frame n. |
int |
getFrameCount()
Gets the number of frames read from file. |
java.awt.Image |
getImage()
Gets the first (or only) image read. |
int |
getLoopCount()
Gets the "Netscape" iteration count, if any. |
protected int[] |
getPixels()
Creates new frame image from current data (and previous frames as specified by their disposition codes). |
protected void |
init()
Initializes or re-initializes reader |
protected int |
read()
Reads a single byte from the input stream. |
int |
read(java.io.BufferedInputStream is)
Reads GIF image from stream |
int |
read(java.lang.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 extenstion 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 |
skip()
Skips variable length blocks up to and including next zero length block. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int STATUS_OK
public static final int STATUS_FORMAT_ERROR
public static final int STATUS_OPEN_ERROR
protected java.io.BufferedInputStream in
protected int status
protected int width
protected int height
protected boolean gctFlag
protected int gctSize
protected int loopCount
protected int[] gct
protected int[] lct
protected int[] act
protected int bgIndex
protected int bgColor
protected int lastBgColor
protected int pixelAspect
protected boolean lctFlag
protected boolean interlace
protected int lctSize
protected int ix
protected int iy
protected int iw
protected int ih
protected java.awt.Rectangle lastRect
protected int[] image
protected int[] lastImage
protected byte[] block
protected int blockSize
protected int dispose
protected int lastDispose
protected boolean transparency
protected int delay
protected int transIndex
protected static final int MaxStackSize
protected short[] prefix
protected byte[] suffix
protected byte[] pixelStack
protected byte[] pixels
protected java.util.Vector frames
protected int frameCount
| Constructor Detail |
|---|
public GifDecoder()
| Method Detail |
|---|
public int getDelay(int n)
n - int index of frame
public java.awt.Image getFrame(int n)
public int getFrameCount()
public java.awt.Image getImage()
public int getLoopCount()
public int read(java.io.BufferedInputStream is)
is - containing GIF file.
public int read(java.lang.String name)
name - String containing source
protected void decodeImageData()
protected boolean err()
protected void init()
protected int read()
protected int readBlock()
protected int[] readColorTable(int ncolors)
ncolors - int number of colors to read
protected void readContents()
protected void readGraphicControlExt()
protected void readHeader()
protected void readImage()
protected void readLSD()
protected void readNetscapeExt()
protected int readShort()
protected void resetFrame()
protected int[] getPixels()
public static int encodeColor(java.awt.Color c)
public static int encodeColor(int r,
int g,
int b)
protected void skip()
|
GeneThello Home | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||