|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectto.etc.sjit.AnimGifEncoder
public class AnimGifEncoder
This class can be used to write an animated GIF file by combining several images. It is loosely based on the Acme GIF encoder.
The characteristics of the generated Gif 89a image are:
An example of how to save an image to GIF is:
import to.etc.sjit.*; // Simple Java Imaging Tools private void saveGIF(File f, Image i2) throws IOException { OutputStream ros = new FileOutputStream(f); try { AnimGifEncoder ge = new AnimGifEncoder(ros); ge.add(i); ge.encode(); } finally { try { if(ros != null) ros.close(); } catch {} } }
Field Summary | |
---|---|
boolean |
m_no_opt
|
Constructor Summary | |
---|---|
AnimGifEncoder(java.io.OutputStream os)
This constructor creates an empty default codec. |
|
AnimGifEncoder(java.io.OutputStream os,
boolean interlace)
Creates a codec and specify interlace (not implemented yet). |
Method Summary | |
---|---|
void |
add(java.awt.Image ima)
Adds the specified image to the list of images. |
void |
add(java.awt.Image ima,
int delay)
Adds the specified image to the list of images. |
void |
add(java.awt.Image ima,
int delaytime,
boolean interlace,
int px,
int py)
Adds the specified image to the list of images. |
void |
encode()
Creates the GIF file from all images added to the encoder. |
void |
flush()
Releases ALL cached resources. |
void |
setLoop(boolean loop)
For animated GIF's the default is to LOOP all images in the GIF file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean m_no_opt
Constructor Detail |
---|
public AnimGifEncoder(java.io.OutputStream os)
public AnimGifEncoder(java.io.OutputStream os, boolean interlace)
Method Detail |
---|
public void setLoop(boolean loop)
For animated GIF's the default is to LOOP all images in the GIF file. This means that after displaying all images in the file the first image is redisplayed ad infinitum.
To prevent the images from looping call setLoop(false) before calling the encode() method.
The current version does not allow the number of repetitions to be specified.
public void flush()
public void add(java.awt.Image ima, int delaytime, boolean interlace, int px, int py) throws java.io.IOException
java.io.IOException
public void add(java.awt.Image ima) throws java.io.IOException
java.io.IOException
public void add(java.awt.Image ima, int delay) throws java.io.IOException
java.io.IOException
public void encode() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |