Class GifRecorder
java.lang.Object
org.openpatch.scratch.extensions.recorder.Recorder
org.openpatch.scratch.extensions.recorder.GifRecorder
The GifRecorder class is responsible for recording and saving frames as GIF images. It extends
the Recorder class and utilizes the AnimatedGifEncoder to create GIF files.
The class provides methods to start and stop the recording process, save individual frames, and capture snapshots as GIF images.
The GifRecorder class handles potential NullPointerExceptions that may occur during the frame saving process.
Example usage:
GifRecorder recorder = new GifRecorder("output.gif");
recorder.start();
// Capture frames
recorder.stop();
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
transparent
The transparent color used in the GIF image.
-
-
Constructor Details
-
GifRecorder
Constructs a new GifRecorder object.- Parameters:
filePath
- the path where the GIF file will be saved
-
-
Method Details
-
saveFrame
public void saveFrame()Saves the current frame of the applet as a GIF image.This method captures the current frame from the applet, sets the frame rate, and adds the frame to the GIF encoder. If the applet's pixels are null, the frame is not saved.
Note: This method catches and ignores any NullPointerException that may occur.
-
snapshot
public void snapshot()Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the current frame, and then finishes the encoding process. -
start
public void start()Starts the GIF recording process. -
stop
public void stop()Stops the GIF recording process and finalizes the GIF file.
-