net.jmge.gif
public abstract class Gif89Frame extends Object
An instance of this class is used in conjunction with a Gif89Encoder object to represent and encode a single static image and its associated "control" data. A Gif89Frame doesn't know or care whether it is encoding one of the many animation frames in a GIF movie, or the single bitmap in a "normal" GIF. (FYI, this design mirrors the encoded GIF structure.)
Since Gif89Frame is an abstract class we don't instantiate it directly, but instead create instances of its concrete subclasses, IndexGif89Frame and DirectGif89Frame. From the API standpoint, these subclasses differ only in the sort of data their instances are constructed from. Most folks will probably work with DirectGif89Frame, since it can be constructed from a java.awt.Image object, but the lower-level IndexGif89Frame class offers advantages in specialized circumstances. (Of course, in routine situations you might not explicitly instantiate any frames at all, instead letting Gif89Encoder's convenience methods do the honors.)
As far as the public API is concerned, objects in the Gif89Frame hierarchy interact with a Gif89Encoder only via the latter's methods for adding and querying frames. (As a side note, you should know that while Gif89Encoder objects are permanently modified by the addition of Gif89Frames, the reverse is NOT true. That is, even though the ultimate encoding of a Gif89Frame may be affected by the context its parent encoder object provides, it retains its original condition and can be reused in a different context.)
The core pixel-encoding code in this class was essentially lifted from Jef Poskanzer's well-known Acme GifEncoder, so please see the readme containing his notice.
See Also: Gif89Encoder DirectGif89Frame IndexGif89Frame
| Field Summary | |
|---|---|
| static int | DM_BGCOLOR The animated GIF renderer shall replace this Gif89Frame's area with the
background color. |
| static int | DM_LEAVE The animated GIF renderer shall take no display-disposal action. |
| static int | DM_REVERT The animated GIF renderer shall replace this Gif89Frame's area with the
previous frame's bitmap. |
| static int | DM_UNDEFINED The animated GIF renderer shall decide how to dispose of this Gif89Frame's
display area. |
| Method Summary | |
|---|---|
| void | setDelay(int interval) Set the between-frame interval.
|
| void | setDisposalMode(int code) Setting this option determines (in a cooperative GIF-viewer) what will be
done with this frame's display area before the subsequent frame is
displayed. |
| void | setInterlaced(boolean b) Set or clear the interlace flag.
|
| void | setPosition(Point p) Set the position of this frame within a larger animation display space.
|
See Also: Gif89Frame
See Also: Gif89Frame
See Also: Gif89Frame
See Also: Gif89Frame
Parameters: interval Centiseconds to wait before displaying the subsequent frame. (Default: 0)
Parameters: code One of the four int constants of the Gif89Frame.DM_* series. (Default: DM_LEAVE)
Parameters: b true if you want interlacing. (Default: false)
Parameters: p Coordinates of the frame's upper left corner in the display space. (Default: The logical display's origin [0, 0])
See Also: Gif89Encoder