|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.media.core.ScratchVideoRecorder
public abstract class ScratchVideoRecorder
This VideoRecorder records to a scratch file which is then copied as needed.
Field Summary | |
---|---|
protected boolean |
canRecord
|
protected static javax.swing.JFileChooser |
chooser
|
protected static javax.swing.text.JTextComponent |
chooserField
|
protected java.awt.Dimension |
dim
|
protected static java.lang.String |
ext
|
protected int |
frameCount
|
protected double |
frameDuration
|
protected java.awt.Image |
frameImage
|
protected boolean |
hasContent
|
protected static boolean |
ignoreChooser
|
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 Summary | |
---|---|
ScratchVideoRecorder(VideoType vidType)
Constructs a ScratchVideoRecorder for the specified video type. |
Method Summary | |
---|---|
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. |
java.lang.String |
getFileName()
Gets the file name of the destination video. |
protected java.io.File |
getFileToBeSaved(java.io.File file)
Return the file that will be saved if the specified file is selected. |
Video |
getVideo()
Gets the current scratch video. |
void |
reset()
Discards the current video and resets the recorder to a ready state. |
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. |
void |
setSize(java.awt.Dimension dimension)
Sets the size of the video. |
protected abstract boolean |
startRecording()
Starts the video recording process using current dimension dim. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static javax.swing.JFileChooser chooser
protected static javax.swing.text.JTextComponent chooserField
protected static java.lang.String ext
protected static boolean ignoreChooser
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
Constructor Detail |
---|
public ScratchVideoRecorder(VideoType vidType)
vidType
- the video typeMethod Detail |
---|
public void createVideo() throws java.io.IOException
createVideo
in interface VideoRecorder
java.io.IOException
public void createVideo(java.lang.String fileName) throws java.io.IOException
createVideo
in interface VideoRecorder
fileName
- name of the file to which the video will be written
java.io.IOException
public void setSize(java.awt.Dimension dimension)
setSize
in interface VideoRecorder
dimension
- the dimensions of the new videopublic void setFrameDuration(double millis)
setFrameDuration
in interface VideoRecorder
millis
- the duration per frame in millisecondspublic void addFrame(java.awt.Image image) throws java.io.IOException
addFrame
in interface VideoRecorder
image
- the image to be drawn on the video frame.
java.io.IOException
public Video getVideo() throws java.io.IOException
getVideo
in interface VideoRecorder
java.io.IOException
public java.lang.String saveVideo() throws java.io.IOException
saveVideo
in interface VideoRecorder
java.io.IOException
public java.lang.String saveVideo(java.lang.String fileName) throws java.io.IOException
saveVideo
in interface VideoRecorder
fileName
- the file name
java.io.IOException
public java.lang.String saveVideoAs() throws java.io.IOException
saveVideoAs
in interface VideoRecorder
java.io.IOException
public java.lang.String getFileName()
getFileName
in interface VideoRecorder
public void setFileName(java.lang.String path)
setFileName
in interface VideoRecorder
path
- the file namepublic void reset()
reset
in interface VideoRecorder
protected void createScratch() throws java.io.IOException
java.io.IOException
protected java.io.File selectFile()
protected java.io.File getFileToBeSaved(java.io.File file)
file
- the file selected with the chooser
protected abstract void saveScratch() throws java.io.IOException
java.io.IOException
protected abstract boolean startRecording()
protected abstract boolean append(java.awt.Image image)
image
- the image to append
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |