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 classAnimatedGIFWriter.GIFFrame
-
Field Summary
Fields Modifier and Type Field Description static byteAPPLICATION_EXTENSION_LABELstatic byteCOMMENT_EXTENSION_LABELstatic byteEXTENSION_INTRODUCERstatic byteGRAPHIC_CONTROL_LABELstatic byteIMAGE_SEPARATORstatic byteIMAGE_TRAILERstatic byteTEXT_EXTENSION_LABEL
-
Constructor Summary
Constructors Constructor Description AnimatedGIFWriter()AnimatedGIFWriter(boolean isApplyDither)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinishWrite(java.io.OutputStream os)This is intended to be called after writing all the frames if we write an animated GIF frame by frame.voidprepareForWrite(java.io.OutputStream os, int logicalScreenWidth, int logicalScreenHeight)This is intended to be called first when writing an animated GIF frame by frame.voidsetLoopCount(int loopCount)voidwrite(java.awt.image.BufferedImage img, java.io.OutputStream os)voidwriteAnimatedGIF(AnimatedGIFWriter.GIFFrame[] frames, java.io.OutputStream os)Writes an array of GIFFrame as an animated GIFvoidwriteAnimatedGIF(java.awt.image.BufferedImage[] images, int[] delays, java.io.OutputStream os)Writes an array of BufferedImage as an animated GIFvoidwriteAnimatedGIF(java.util.List<AnimatedGIFWriter.GIFFrame> frames, java.io.OutputStream os)Writes a list of GIFFrame as an animated GIFvoidwriteFrame(java.io.OutputStream os, AnimatedGIFWriter.GIFFrame frame)voidwriteFrame(java.io.OutputStream os, java.awt.image.BufferedImage frame)voidwriteFrame(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.ExceptionThis 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.ExceptionThis 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.ExceptionWrites 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
-
-