Class 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 Detail

      • MovieMaker

        public MovieMaker​(int frameRate,
                          File file,
                          String movieType)
    • 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 frame
        sleepCount - 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 interface javax.media.ControllerListener
      • dataSinkUpdate

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