uk.co.silentsoftware.core.converters.video
Class GifSequenceWriter

java.lang.Object
  extended by uk.co.silentsoftware.core.converters.video.GifSequenceWriter

public class GifSequenceWriter
extends java.lang.Object


Field Summary
private  javax.imageio.ImageWriter gifWriter
           
private  javax.imageio.metadata.IIOMetadata imageMetaData
           
private  javax.imageio.ImageWriteParam imageWriteParam
           
 
Constructor Summary
GifSequenceWriter(javax.imageio.stream.ImageOutputStream outputStream, int imageType, int timeBetweenFramesMS, boolean loopContinuously)
          Creates a new GifSequenceWriter
 
Method Summary
 void close()
          Close this GifSequenceWriter object.
private static javax.imageio.metadata.IIOMetadataNode getNode(javax.imageio.metadata.IIOMetadataNode rootNode, java.lang.String nodeName)
          Returns an existing child node, or creates and returns a new child node (if the requested node does not exist).
private static javax.imageio.ImageWriter getWriter()
          Returns the first available GIF ImageWriter using ImageIO.getImageWritersBySuffix("gif").
 void writeToSequence(java.awt.image.RenderedImage img)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gifWriter

private final javax.imageio.ImageWriter gifWriter

imageWriteParam

private javax.imageio.ImageWriteParam imageWriteParam

imageMetaData

private javax.imageio.metadata.IIOMetadata imageMetaData
Constructor Detail

GifSequenceWriter

public GifSequenceWriter(javax.imageio.stream.ImageOutputStream outputStream,
                         int imageType,
                         int timeBetweenFramesMS,
                         boolean loopContinuously)
                  throws javax.imageio.IIOException,
                         java.io.IOException
Creates a new GifSequenceWriter

Parameters:
outputStream - the ImageOutputStream to be written to
imageType - one of the imageTypes specified in BufferedImage
timeBetweenFramesMS - the time between frames in miliseconds
loopContinuously - whether the gif should loop repeatedly
Throws:
javax.imageio.IIOException - if no gif ImageWriters are found
java.io.IOException
Method Detail

writeToSequence

public void writeToSequence(java.awt.image.RenderedImage img)
                     throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Close this GifSequenceWriter object. This does not close the underlying stream, just finishes off the GIF.

Throws:
java.io.IOException

getWriter

private static javax.imageio.ImageWriter getWriter()
                                            throws javax.imageio.IIOException
Returns the first available GIF ImageWriter using ImageIO.getImageWritersBySuffix("gif").

Returns:
a GIF ImageWriter object
Throws:
javax.imageio.IIOException - if no GIF image writers are returned

getNode

private static javax.imageio.metadata.IIOMetadataNode getNode(javax.imageio.metadata.IIOMetadataNode rootNode,
                                                              java.lang.String nodeName)
Returns an existing child node, or creates and returns a new child node (if the requested node does not exist).

Parameters:
rootNode - the IIOMetadataNode to search for the child node.
nodeName - the name of the child node.
Returns:
the child node, if found or a new node created with the given name.