public abstract class ScratchVideoRecorder extends java.lang.Object implements VideoRecorder
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
canRecord |
protected static javax.swing.JFileChooser |
chooser |
protected java.awt.Dimension |
dim |
protected int |
frameCount |
protected double |
frameDuration |
protected java.awt.Image |
frameImage |
protected boolean |
hasContent |
protected boolean |
isSaved |
protected boolean |
saveChanges |
protected java.io.File |
saveFile |
protected java.io.File |
scratchFile |
protected java.lang.String |
scratchName |
protected int |
scratchNumber |
protected VideoType |
videoType |
| Constructor and Description |
|---|
ScratchVideoRecorder(VideoType vidType)
Constructs a ScratchVideoRecorder for the specified video type.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFrame(java.awt.Image image)
Adds a video frame with the specified image.
|
protected abstract boolean |
append(java.awt.Image image)
Appends a frame to the current video.
|
protected void |
createScratch()
Creates the scratch file.
|
void |
createVideo()
Creates a new video (scratch file) and sets fileName to null.
|
void |
createVideo(java.lang.String fileName)
Creates a new video and sets the destination file name.
|
void |
createVideo(java.lang.String fileName,
int width,
int height)
Creates the file to which a newly created video will be written.
|
java.lang.String |
getFileName()
Gets the file name of the destination video.
|
Video |
getVideo()
Gets the current scratch video.
|
protected abstract void |
saveScratch()
Saves the current video to the scratch file.
|
java.lang.String |
saveVideo()
Saves the scratch video to the current file or chooser file.
|
java.lang.String |
saveVideo(java.lang.String fileName)
Saves the current scratch video to the specified file name.
|
java.lang.String |
saveVideoAs()
Saves the scratch video to a file picked from a chooser.
|
protected java.io.File |
selectFile()
Shows a save dialog used to set the output movie file.
|
void |
setFileName(java.lang.String path)
Sets the file name.
|
void |
setFrameDuration(double millis)
Sets the time duration per frame.
|
protected abstract boolean |
startRecording()
Starts the video recording process using current dimension dim.
|
protected static javax.swing.JFileChooser chooser
protected VideoType videoType
protected java.awt.Dimension dim
protected java.awt.Image frameImage
protected double frameDuration
protected int frameCount
protected java.lang.String scratchName
protected int scratchNumber
protected java.io.File scratchFile
protected boolean canRecord
protected boolean hasContent
protected boolean isSaved
protected java.io.File saveFile
protected boolean saveChanges
public ScratchVideoRecorder(VideoType vidType)
vidType - the video typepublic void createVideo()
throws java.io.IOException
createVideo in interface VideoRecorderjava.io.IOExceptionpublic void createVideo(java.lang.String fileName)
throws java.io.IOException
createVideo in interface VideoRecorderfileName - name of the file to which the video will be writtenjava.io.IOExceptionpublic void createVideo(java.lang.String fileName,
int width,
int height)
throws java.io.IOException
createVideo in interface VideoRecorderfileName - name of the file to which the video will be writtenwidth - width of the new videoheight - height of the new videojava.io.IOExceptionpublic void setFrameDuration(double millis)
setFrameDuration in interface VideoRecordermillis - the duration per frame in millisecondspublic void addFrame(java.awt.Image image)
throws java.io.IOException
addFrame in interface VideoRecorderimage - the image to be drawn on the video frame.java.io.IOExceptionpublic Video getVideo() throws java.io.IOException
getVideo in interface VideoRecorderjava.io.IOExceptionpublic java.lang.String saveVideo()
throws java.io.IOException
saveVideo in interface VideoRecorderjava.io.IOExceptionpublic java.lang.String saveVideo(java.lang.String fileName)
throws java.io.IOException
saveVideo in interface VideoRecorderfileName - the file namejava.io.IOExceptionpublic java.lang.String saveVideoAs()
throws java.io.IOException
saveVideoAs in interface VideoRecorderjava.io.IOExceptionpublic java.lang.String getFileName()
getFileName in interface VideoRecorderpublic void setFileName(java.lang.String path)
setFileName in interface VideoRecorderpath - the file nameprotected void createScratch()
throws java.io.IOException
java.io.IOExceptionprotected java.io.File selectFile()
protected abstract void saveScratch()
throws java.io.IOException
java.io.IOExceptionprotected abstract boolean startRecording()
protected abstract boolean append(java.awt.Image image)
image - the image to append