Package net.targetr.tncaptcha
Class GifSequenceWriter
java.lang.Object
net.targetr.tncaptcha.GifSequenceWriter
Utility class for writing a sequence of images as an animated GIF.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IIOMetadataThe metadata associated with the GIF sequence.protected ImageWriteParamThe write parameters for the image writer.protected ImageWriterThe image writer used to create the GIF sequence. -
Constructor Summary
ConstructorsConstructorDescriptionGifSequenceWriter(ImageOutputStream out, int imageType, int delay, boolean loop) Constructs a new GifSequenceWriter. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the GIF sequence writer and finishes writing the sequence.voidWrites a new frame to the GIF sequence.
-
Field Details
-
writer
The image writer used to create the GIF sequence. -
params
The write parameters for the image writer. -
metadata
The metadata associated with the GIF sequence.
-
-
Constructor Details
-
GifSequenceWriter
public GifSequenceWriter(ImageOutputStream out, int imageType, int delay, boolean loop) throws IOException Constructs a new GifSequenceWriter.- Parameters:
out- the output streamimageType- the type of the imagedelay- the delay between frames in millisecondsloop- whether the sequence should loop continuously- Throws:
IOException- if an I/O error occurs
-
-
Method Details
-
writeToSequence
Writes a new frame to the GIF sequence.- Parameters:
img- the image to write- Throws:
IOException- if an I/O error occurs
-
close
Closes the GIF sequence writer and finishes writing the sequence.- Throws:
IOException- if an I/O error occurs
-