uk.co.silentsoftware.core.converters.video
Class GifSequenceWriter
java.lang.Object
uk.co.silentsoftware.core.converters.video.GifSequenceWriter
public class GifSequenceWriter
- extends java.lang.Object
|
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 |
gifWriter
private final javax.imageio.ImageWriter gifWriter
imageWriteParam
private javax.imageio.ImageWriteParam imageWriteParam
imageMetaData
private javax.imageio.metadata.IIOMetadata imageMetaData
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 toimageType - one of the imageTypes specified in BufferedImagetimeBetweenFramesMS - the time between frames in milisecondsloopContinuously - whether the gif should loop repeatedly
- Throws:
javax.imageio.IIOException - if no gif ImageWriters are found
java.io.IOException
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.