Class AnimatedGIFWriter


  • public class AnimatedGIFWriter
    extends java.lang.Object
    • Constructor Detail

      • AnimatedGIFWriter

        public AnimatedGIFWriter()
      • AnimatedGIFWriter

        public AnimatedGIFWriter​(boolean isApplyDither)
    • 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 GIF
        logicalScreenWidth - width of the logical screen. If it is less than or equal zero, it will be determined from the first frame
        logicalScreenHeight - 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 BufferedImage
        delays - delays in millisecond for each frame
        os - 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 GIFFrame
        os - 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 GIFFrame
        os - 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