uchicago.src.sim.gui
Class MovieMaker

java.lang.Object
  extended by uchicago.src.sim.gui.MovieMaker
All Implemented Interfaces:
javax.media.ControllerListener, javax.media.datasink.DataSinkListener

public class MovieMaker
extends java.lang.Object
implements javax.media.ControllerListener, javax.media.datasink.DataSinkListener

Takes DisplaySurface images and makes movies out of them. All messages sent to this class should be done through DisplaySurface.

Version:
$Revision: 1.5 $ $Date: 2004/11/03 19:50:59 $
Author:
Nick Collier

Constructor Summary
MovieMaker(int width, int height, int frameRate, java.lang.String fileName, java.lang.String movieType)
           
 
Method Summary
 void addImageAsFrame(java.awt.Image image)
          Adds an image to a movie as a frame with a default sleep value of 40
 void addImageAsFrame(java.awt.Image 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)
           
 boolean init(javax.media.format.RGBFormat format)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MovieMaker

public MovieMaker(int width,
                  int height,
                  int frameRate,
                  java.lang.String fileName,
                  java.lang.String movieType)
Method Detail

init

public boolean init(javax.media.format.RGBFormat format)

addImageAsFrame

public void addImageAsFrame(java.awt.Image image)
Adds an image to a movie as a frame with a default sleep value of 40

Parameters:
image - the image to add as a frame

addImageAsFrame

public void addImageAsFrame(java.awt.Image image,
                            int sleepCount)
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 frame
sleepCount - the amount to pause for writing images to disk

cleanUp

public void cleanUp()

controllerUpdate

public void controllerUpdate(javax.media.ControllerEvent evt)
Specified by:
controllerUpdate in interface javax.media.ControllerListener

dataSinkUpdate

public void dataSinkUpdate(javax.media.datasink.DataSinkEvent evt)
Specified by:
dataSinkUpdate in interface javax.media.datasink.DataSinkListener