com.threerings.cast
Class CompositedMultiFrameImage

java.lang.Object
  extended by com.threerings.cast.CompositedMultiFrameImage
All Implemented Interfaces:
TrimmedMultiFrameImage, MultiFrameImage
Direct Known Subclasses:
CompositedMaskedImage, CompositedShadowImage

public class CompositedMultiFrameImage
extends Object
implements TrimmedMultiFrameImage

Used to composite the action frames for a particular orientation of a CompositedActionFrames.


Nested Class Summary
protected  class CompositedMultiFrameImage.CompositedVolatileMirage
          Used to create our mirage using the source action frame images.
protected  class CompositedMultiFrameImage.SubmirageForwarder
          A CompositedMirage that forwards all of its Mirage calls to a delegate Mirage.
 
Field Summary
protected  String _action
          The action we're compositing.
protected  CompositedMirage[] _images
          Our composited action frame images.
protected  ImageManager _imgr
          The image manager from whom we load our images.
protected  int _orient
          The orientation we're compositing.
protected  CompositedActionFrames.ComponentFrames[] _sources
          The action frames from which we obtain our source imagery.
 
Constructor Summary
CompositedMultiFrameImage(ImageManager imgr, CompositedActionFrames.ComponentFrames[] sources, String action, int orient)
           
 
Method Summary
protected  CompositedMirage createCompositedMirage(int index)
          Creates a composited image for the specified frame.
 long getEstimatedMemoryUsage()
          Returns the estimated memory usage of our composited frame images.
protected  Mirage getFrame(int orient, int index)
           
 int getFrameCount()
          Returns the number of frames in this multi-frame image.
 int getHeight(int index)
          Returns the height of the specified frame image.
 void getTrimmedBounds(int index, Rectangle bounds)
          Fills in the minimum bounding rectangle for this image that contains all non-transparent pixels.
 int getWidth(int index)
          Returns the width of the specified frame image.
 int getXOrigin(int index)
           
 int getYOrigin(int index)
           
 boolean hitTest(int index, int x, int y)
          Returns true if the specified frame contains a non-transparent pixel at the specified coordinates.
 void paintFrame(Graphics2D g, int index, int x, int y)
          Renders the specified frame into the specified graphics object at the specified coordinates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_imgr

protected ImageManager _imgr
The image manager from whom we load our images.


_sources

protected CompositedActionFrames.ComponentFrames[] _sources
The action frames from which we obtain our source imagery.


_action

protected String _action
The action we're compositing.


_orient

protected int _orient
The orientation we're compositing.


_images

protected CompositedMirage[] _images
Our composited action frame images.

Constructor Detail

CompositedMultiFrameImage

public CompositedMultiFrameImage(ImageManager imgr,
                                 CompositedActionFrames.ComponentFrames[] sources,
                                 String action,
                                 int orient)
Method Detail

getFrameCount

public int getFrameCount()
Description copied from interface: MultiFrameImage
Returns the number of frames in this multi-frame image.

Specified by:
getFrameCount in interface MultiFrameImage

getWidth

public int getWidth(int index)
Description copied from interface: MultiFrameImage
Returns the width of the specified frame image.

Specified by:
getWidth in interface MultiFrameImage

getHeight

public int getHeight(int index)
Description copied from interface: MultiFrameImage
Returns the height of the specified frame image.

Specified by:
getHeight in interface MultiFrameImage

getXOrigin

public int getXOrigin(int index)

getYOrigin

public int getYOrigin(int index)

paintFrame

public void paintFrame(Graphics2D g,
                       int index,
                       int x,
                       int y)
Description copied from interface: MultiFrameImage
Renders the specified frame into the specified graphics object at the specified coordinates.

Specified by:
paintFrame in interface MultiFrameImage

hitTest

public boolean hitTest(int index,
                       int x,
                       int y)
Description copied from interface: MultiFrameImage
Returns true if the specified frame contains a non-transparent pixel at the specified coordinates.

Specified by:
hitTest in interface MultiFrameImage

getTrimmedBounds

public void getTrimmedBounds(int index,
                             Rectangle bounds)
Description copied from interface: TrimmedMultiFrameImage
Fills in the minimum bounding rectangle for this image that contains all non-transparent pixels. If this information is unavailable, the bounds of the entire image may be returned in exchange for improved performance.

Specified by:
getTrimmedBounds in interface TrimmedMultiFrameImage

getEstimatedMemoryUsage

public long getEstimatedMemoryUsage()
Returns the estimated memory usage of our composited frame images.


createCompositedMirage

protected CompositedMirage createCompositedMirage(int index)
Creates a composited image for the specified frame.


getFrame

protected Mirage getFrame(int orient,
                          int index)