vmm.core
Class Filmstrip

java.lang.Object
  extended by vmm.core.Filmstrip

public class Filmstrip
extends java.lang.Object

A Filmstrip is just a sequence of images. It is possible for some of the images in the Filmstrip to be null. The images are numbered starting at zero. There is no preset limit on the number of images.


Constructor Summary
Filmstrip()
           
 
Method Summary
 java.awt.image.BufferedImage getFrame(int frameNumber)
          Returns the image at at a specified position in the filmstrip.
 int getFrameCount()
          Returns the current number of frames in the filmstrip.
static int maxFrames(int width, int height, boolean color)
          Attempts to determine how many filmstrip frames an still be created with a specified size.
 void setFrame(int frameNumber, java.awt.image.BufferedImage image)
          Sets a specified frame in the filmstrip to a given image.
 void stripNullFrames()
          Removes any frames for which the image is null from the filmstrip.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filmstrip

public Filmstrip()
Method Detail

maxFrames

public static int maxFrames(int width,
                            int height,
                            boolean color)
Attempts to determine how many filmstrip frames an still be created with a specified size. This is not necessarily going to give an exact value; the value is likely to be an underestimate.

Parameters:
width - the width in pixels of the images
height - the height in pixels of the images
color - are the images to be colored (4 bytes per pixel) or black and white (1 byte per pixel)?
See Also:
Util.availableMemory()

setFrame

public void setFrame(int frameNumber,
                     java.awt.image.BufferedImage image)
Sets a specified frame in the filmstrip to a given image. If frameNumber is less than the current filmstrip size, then the current frame at position frameNumber is replaced. Otherwise the size of the filmstrip is increased to (frameNumber+1) and the image is then stored in position frameNumber as the last frame in the filmstrip. Any extra locations that are created are filled with nulls.

Parameters:
frameNumber - The position in the filmstrip where the image is to be added. An error occurs if this is less than zero.
image - The image that is to be put at postion frameNumber in the filmstrip. This can be null.

getFrameCount

public int getFrameCount()
Returns the current number of frames in the filmstrip.


getFrame

public java.awt.image.BufferedImage getFrame(int frameNumber)
Returns the image at at a specified position in the filmstrip. The return value can be null.

Parameters:
frameNumber - The number of the frame that is to be returned. An error occurs if this is not greater than or equal to zero and less than getFrameCount().

stripNullFrames

public void stripNullFrames()
Removes any frames for which the image is null from the filmstrip.