Package com.actelion.research.util
Class AnimatedGIFWriter
- java.lang.Object
-
- com.actelion.research.util.AnimatedGIFWriter
-
public class AnimatedGIFWriter extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AnimatedGIFWriter.GIFFrame
-
Field Summary
Fields Modifier and Type Field Description static byte
APPLICATION_EXTENSION_LABEL
static byte
COMMENT_EXTENSION_LABEL
static byte
EXTENSION_INTRODUCER
static byte
GRAPHIC_CONTROL_LABEL
static byte
IMAGE_SEPARATOR
static byte
IMAGE_TRAILER
static byte
TEXT_EXTENSION_LABEL
-
Constructor Summary
Constructors Constructor Description AnimatedGIFWriter()
AnimatedGIFWriter(boolean isApplyDither)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finishWrite(java.io.OutputStream os)
This is intended to be called after writing all the frames if we write an animated GIF frame by frame.void
prepareForWrite(java.io.OutputStream os, int logicalScreenWidth, int logicalScreenHeight)
This is intended to be called first when writing an animated GIF frame by frame.void
setLoopCount(int loopCount)
void
write(java.awt.image.BufferedImage img, java.io.OutputStream os)
void
writeAnimatedGIF(AnimatedGIFWriter.GIFFrame[] frames, java.io.OutputStream os)
Writes an array of GIFFrame as an animated GIFvoid
writeAnimatedGIF(java.awt.image.BufferedImage[] images, int[] delays, java.io.OutputStream os)
Writes an array of BufferedImage as an animated GIFvoid
writeAnimatedGIF(java.util.List<AnimatedGIFWriter.GIFFrame> frames, java.io.OutputStream os)
Writes a list of GIFFrame as an animated GIFvoid
writeFrame(java.io.OutputStream os, AnimatedGIFWriter.GIFFrame frame)
void
writeFrame(java.io.OutputStream os, java.awt.image.BufferedImage frame)
void
writeFrame(java.io.OutputStream os, java.awt.image.BufferedImage frame, int delay)
-
-
-
Field Detail
-
IMAGE_SEPARATOR
public static final byte IMAGE_SEPARATOR
- See Also:
- Constant Field Values
-
IMAGE_TRAILER
public static final byte IMAGE_TRAILER
- See Also:
- Constant Field Values
-
EXTENSION_INTRODUCER
public static final byte EXTENSION_INTRODUCER
- See Also:
- Constant Field Values
-
GRAPHIC_CONTROL_LABEL
public static final byte GRAPHIC_CONTROL_LABEL
- See Also:
- Constant Field Values
-
APPLICATION_EXTENSION_LABEL
public static final byte APPLICATION_EXTENSION_LABEL
- See Also:
- Constant Field Values
-
COMMENT_EXTENSION_LABEL
public static final byte COMMENT_EXTENSION_LABEL
- See Also:
- Constant Field Values
-
TEXT_EXTENSION_LABEL
public static final byte TEXT_EXTENSION_LABEL
- See Also:
- Constant Field Values
-
-
Method Detail
-
write
public void write(java.awt.image.BufferedImage img, java.io.OutputStream os) throws java.lang.Exception
- Throws:
java.lang.Exception
-
finishWrite
public void finishWrite(java.io.OutputStream os) throws java.lang.Exception
This is intended to be called after writing all the frames if we write an animated GIF frame by frame.- Parameters:
os
- OutputStream for the animated GIF- Throws:
java.lang.Exception
-
prepareForWrite
public void prepareForWrite(java.io.OutputStream os, int logicalScreenWidth, int logicalScreenHeight) throws java.lang.Exception
This is intended to be called first when writing an animated GIF frame by frame.- Parameters:
os
- OutputStream for the animated GIFlogicalScreenWidth
- width of the logical screen. If it is less than or equal zero, it will be determined from the first framelogicalScreenHeight
- height of the logical screen. If it is less than or equal zero, it will be determined from the first frame- Throws:
java.lang.Exception
-
setLoopCount
public void setLoopCount(int loopCount)
-
writeAnimatedGIF
public void writeAnimatedGIF(java.awt.image.BufferedImage[] images, int[] delays, java.io.OutputStream os) throws java.lang.Exception
Writes an array of BufferedImage as an animated GIF- Parameters:
images
- an array of BufferedImagedelays
- delays in millisecond for each frameos
- OutputStream for the animated GIF- Throws:
java.lang.Exception
-
writeAnimatedGIF
public void writeAnimatedGIF(AnimatedGIFWriter.GIFFrame[] frames, java.io.OutputStream os) throws java.lang.Exception
Writes an array of GIFFrame as an animated GIF- Parameters:
frames
- an array of GIFFrameos
- OutputStream for the animated GIF- Throws:
java.lang.Exception
-
writeAnimatedGIF
public void writeAnimatedGIF(java.util.List<AnimatedGIFWriter.GIFFrame> frames, java.io.OutputStream os) throws java.lang.Exception
Writes a list of GIFFrame as an animated GIF- Parameters:
frames
- a list of GIFFrameos
- OutputStream for the animated GIF- Throws:
java.lang.Exception
-
writeFrame
public void writeFrame(java.io.OutputStream os, AnimatedGIFWriter.GIFFrame frame) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeFrame
public void writeFrame(java.io.OutputStream os, java.awt.image.BufferedImage frame) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeFrame
public void writeFrame(java.io.OutputStream os, java.awt.image.BufferedImage frame, int delay) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-