j2d.io.gif.gifAnimation
Class Gif89Frame

java.lang.Object
  extended by j2d.io.gif.gifAnimation.Gif89Frame
Direct Known Subclasses:
DirectGif89Frame, IndexGif89Frame

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 affineTransform 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.

Version:
0.90 beta (15-Jul-2000)
Author:
J. M. G. Elliott (tep@jmge.net)
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(java.awt.Point p)
          Set the position of this frame within a larger animation display space.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DM_UNDEFINED

public static final int DM_UNDEFINED
The animated GIF renderer shall decide how to dispose of this Gif89Frame's display area.

See Also:
setDisposalMode(int), Constant Field Values

DM_LEAVE

public static final int DM_LEAVE
The animated GIF renderer shall take no display-disposal action.

See Also:
setDisposalMode(int), Constant Field Values

DM_BGCOLOR

public static final int DM_BGCOLOR
The animated GIF renderer shall replace this Gif89Frame's area with the background color.

See Also:
setDisposalMode(int), Constant Field Values

DM_REVERT

public static final int DM_REVERT
The animated GIF renderer shall replace this Gif89Frame's area with the previous frame's bitmap.

See Also:
setDisposalMode(int), Constant Field Values
Method Detail

setPosition

public void setPosition(java.awt.Point p)
Set the position of this frame within a larger animation display space.

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.setLogicalDisplay(java.awt.Dimension, int)

setInterlaced

public void setInterlaced(boolean b)
Set or clear the interlace flag.

Parameters:
b - true if you want interlacing. (Default: false)

setDelay

public void setDelay(int interval)
Set the between-frame interval.

Parameters:
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.

Parameters:
code - One of the four int constants of the Gif89Frame.DM_* series. (Default: DM_LEAVE)