Package repast.simphony.ui.widget
Class MovieMaker
- java.lang.Object
-
- repast.simphony.ui.widget.MovieMaker
-
- All Implemented Interfaces:
javax.media.ControllerListener
,javax.media.datasink.DataSinkListener
public class MovieMaker extends Object implements javax.media.ControllerListener, javax.media.datasink.DataSinkListener
Makes a quicktime movie from a buffered images.- Author:
- Nick Collier
-
-
Constructor Summary
Constructors Constructor Description MovieMaker(int frameRate, File file, String movieType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addImageAsFrame(BufferedImage image)
Adds an image to a movie as a frame with a default sleep value of 40 millisecondsvoid
addImageAsFrame(BufferedImage image, int sleepCount)
Adds an image to a movie as a frame.void
cleanUp()
void
controllerUpdate(javax.media.ControllerEvent evt)
void
dataSinkUpdate(javax.media.datasink.DataSinkEvent evt)
-
-
-
Method Detail
-
addImageAsFrame
public void addImageAsFrame(BufferedImage image) throws IOException
Adds an image to a movie as a frame with a default sleep value of 40 milliseconds- Parameters:
image
- the image to add as a frame- Throws:
IOException
- if there is an error while adding the frame
-
addImageAsFrame
public void addImageAsFrame(BufferedImage image, int sleepCount) throws IOException
Adds an image to a movie as a frame. This method pause the main simulation thread for the specified amount of time. This pause is necessary to allow the images to be written to disk in a background thread. Without the pauses the images are still written to disk, but are added much faster than they can be written, resulting in increased memory use and eventual OutOfMemoryErrors. This method is called by DisplaySurface and shouldn't be called by a user in the course of writing a model.- Parameters:
image
- the image to add as a framesleepCount
- the amount to pause for writing images to disk- Throws:
IOException
- if there is an error while adding the frame
-
cleanUp
public void cleanUp()
-
controllerUpdate
public void controllerUpdate(javax.media.ControllerEvent evt)
- Specified by:
controllerUpdate
in interfacejavax.media.ControllerListener
-
dataSinkUpdate
public void dataSinkUpdate(javax.media.datasink.DataSinkEvent evt)
- Specified by:
dataSinkUpdate
in interfacejavax.media.datasink.DataSinkListener
-
-