net.jmge.gif
Class Gif89Frame
public abstract class Gif89Frame
extends java.lang.Object
First off, just to dispel any doubt, this class and its subclasses have
nothing to do with GUI "frames" such as java.awt.Frame. We merely use the
term in its very common sense of a still picture in an animation sequence.
It's hoped that the restricted context will prevent any confusion.
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.
Gif89Encoder
, DirectGif89Frame
, IndexGif89Frame
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.
|
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.
|
DM_BGCOLOR
public static final int DM_BGCOLOR
The animated GIF renderer shall replace this Gif89Frame's area with the
background color.
- 2
setDisposalMode(int)
DM_LEAVE
public static final int DM_LEAVE
The animated GIF renderer shall take no display-disposal action.
- 1
setDisposalMode(int)
DM_REVERT
public static final int DM_REVERT
The animated GIF renderer shall replace this Gif89Frame's area with the
previous frame's bitmap.
- 3
setDisposalMode(int)
DM_UNDEFINED
public static final int DM_UNDEFINED
The animated GIF renderer shall decide how to dispose of this Gif89Frame's
display area.
- 0
setDisposalMode(int)
setDelay
public void setDelay(int interval)
Set the between-frame interval.
interval
- Centiseconds to wait before displaying the subsequent frame.
(Default: 0)
setDisposalMode
public 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. For instance, a setting of DM_BGCOLOR can be used for erasure
when redrawing with displacement.
code
- One of the four int constants of the Gif89Frame.DM_* series.
(Default: DM_LEAVE)
setInterlaced
public void setInterlaced(boolean b)
Set or clear the interlace flag.
b
- true if you want interlacing. (Default: false)
setPosition
public void setPosition(Point p)
Set the position of this frame within a larger animation display space.
p
- Coordinates of the frame's upper left corner in the display space.
(Default: The logical display's origin [0, 0])
Gif89Encoder.setLogicalDisplay(Dimension,int)