Package org.opensourcephysics.media.gif
Class GifVideoRecorder
java.lang.Object
org.opensourcephysics.media.core.ScratchVideoRecorder
org.opensourcephysics.media.gif.GifVideoRecorder
- All Implemented Interfaces:
VideoRecorder
This is a gif video recorder that uses scratch files.
- Version:
- 1.0
- Author:
- Douglas Brown
-
Field Summary
Fields inherited from class org.opensourcephysics.media.core.ScratchVideoRecorder
baseDir, canRecord, chooser, chooserField, chosenExtension, dim, ext, frameCount, frameDuration, frameImage, hasContent, ignoreChooser, isSaved, saveChanges, saveFile, scratchFile, scratchName, scratchNumber, suggestedFileName, tempDirectory, tempFileBasePath, tempFilePrefix, tempFiles, tempFileType, videoType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Appends a frame to the current video.getCodec()
Gets the encoder used by this recorder.protected void
Saves the video to the current scratchFile.void
setFrameDuration
(double millis) Sets the time duration per frame.protected boolean
Starts the video recording process.Methods inherited from class org.opensourcephysics.media.core.ScratchVideoRecorder
addFrame, createScratch, createVideo, createVideo, createVideo, deleteFiles, deleteTempFiles, finalize, getFileName, getFileToBeSaved, getScratchExtension, getVideo, getVideoType, reset, saveVideo, saveVideo, saveVideoAs, selectFile, setChooserExtension, setFileName, setSize, suggestFileName
-
Constructor Details
-
GifVideoRecorder
public GifVideoRecorder()Constructs a GifVideoRecorder object.
-
-
Method Details
-
setFrameDuration
public void setFrameDuration(double millis) Sets the time duration per frame.- Specified by:
setFrameDuration
in interfaceVideoRecorder
- Overrides:
setFrameDuration
in classScratchVideoRecorder
- Parameters:
millis
- the duration per frame in milliseconds
-
getGifEncoder
Gets the encoder used by this recorder. The encoder has methods for setting a transparent color, setting a repeat count (0 for continuous play), and setting a quality factor.- Returns:
- the gif encoder
-
saveScratch
protected void saveScratch()Saves the video to the current scratchFile.- Specified by:
saveScratch
in classScratchVideoRecorder
-
startRecording
protected boolean startRecording()Starts the video recording process.- Specified by:
startRecording
in classScratchVideoRecorder
- Returns:
- true if video recording successfully started
-
append
Appends a frame to the current video.- Specified by:
append
in classScratchVideoRecorder
- Parameters:
image
- the image to append- Returns:
- true if image successfully appended
-
getCodec
-