org.opensourcephysics.media.gif
Class GifVideoRecorder

java.lang.Object
  extended by org.opensourcephysics.media.core.ScratchVideoRecorder
      extended by org.opensourcephysics.media.gif.GifVideoRecorder
All Implemented Interfaces:
VideoRecorder

public class GifVideoRecorder
extends ScratchVideoRecorder

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
canRecord, chooser, chooserField, dim, ext, frameCount, frameDuration, frameImage, hasContent, ignoreChooser, isSaved, saveChanges, saveFile, scratchFile, scratchName, scratchNumber, videoType
 
Constructor Summary
GifVideoRecorder()
          Constructs a GifVideoRecorder object.
 
Method Summary
protected  boolean append(java.awt.Image image)
          Appends a frame to the current video.
 AnimatedGifEncoder getGifEncoder()
          Gets the encoder used by this recorder.
protected  void saveScratch()
          Saves the video to the current scratchFile.
 void setFrameDuration(double millis)
          Sets the time duration per frame.
protected  boolean startRecording()
          Starts the video recording process.
 
Methods inherited from class org.opensourcephysics.media.core.ScratchVideoRecorder
addFrame, createScratch, createVideo, createVideo, getFileName, getFileToBeSaved, getVideo, reset, saveVideo, saveVideo, saveVideoAs, selectFile, setFileName, setSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GifVideoRecorder

public GifVideoRecorder()
Constructs a GifVideoRecorder object.

Method Detail

setFrameDuration

public void setFrameDuration(double millis)
Sets the time duration per frame.

Specified by:
setFrameDuration in interface VideoRecorder
Overrides:
setFrameDuration in class ScratchVideoRecorder
Parameters:
millis - the duration per frame in milliseconds

getGifEncoder

public AnimatedGifEncoder 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 class ScratchVideoRecorder

startRecording

protected boolean startRecording()
Starts the video recording process.

Specified by:
startRecording in class ScratchVideoRecorder
Returns:
true if video recording successfully started

append

protected boolean append(java.awt.Image image)
Appends a frame to the current video.

Specified by:
append in class ScratchVideoRecorder
Parameters:
image - the image to append
Returns:
true if image successfully appended