com.threerings.media.image
Class TransformedMirage

java.lang.Object
  extended by com.threerings.media.image.TransformedMirage
All Implemented Interfaces:
Mirage

public class TransformedMirage
extends Object
implements Mirage

Draws a mirage combined with an arbitrary AffineTransform.


Field Summary
protected  Mirage _base
          The base mirage.
protected  Rectangle _bounds
          Our transformed bounds.
protected  AffineTransform _transform
          The transform we apply when painting the base mirage.
 
Constructor Summary
TransformedMirage(Mirage base, AffineTransform transform)
          Constructor for backwards compatibility that automatically repositions the transformed mirage so its new upper-left corner is still at the origin.
TransformedMirage(Mirage base, AffineTransform transform, boolean reposition)
          Constructor.
 
Method Summary
protected  void computeTransformedBounds()
          Compute the bounds of the base Mirage after it has been transformed.
 long getEstimatedMemoryUsage()
          Returns an estimate of the memory consumed by this mirage's image raster data.
 int getHeight()
          Returns the height of this mirage.
 BufferedImage getSnapshot()
          Returns a snapshot of this mirage as a buffered image.
 int getWidth()
          Returns the width of this mirage.
 boolean hitTest(int x, int y)
          Returns true if this mirage contains a non-transparent pixel at the specified coordinate.
 void paint(Graphics2D gfx, int x, int y)
          Renders this mirage at the specified position in the supplied graphics context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_base

protected Mirage _base
The base mirage.


_bounds

protected Rectangle _bounds
Our transformed bounds.


_transform

protected AffineTransform _transform
The transform we apply when painting the base mirage.

Constructor Detail

TransformedMirage

public TransformedMirage(Mirage base,
                         AffineTransform transform)
Constructor for backwards compatibility that automatically repositions the transformed mirage so its new upper-left corner is still at the origin.


TransformedMirage

public TransformedMirage(Mirage base,
                         AffineTransform transform,
                         boolean reposition)
Constructor.

Method Detail

paint

public void paint(Graphics2D gfx,
                  int x,
                  int y)
Description copied from interface: Mirage
Renders this mirage at the specified position in the supplied graphics context.

Specified by:
paint in interface Mirage

getWidth

public int getWidth()
Description copied from interface: Mirage
Returns the width of this mirage.

Specified by:
getWidth in interface Mirage

getHeight

public int getHeight()
Description copied from interface: Mirage
Returns the height of this mirage.

Specified by:
getHeight in interface Mirage

hitTest

public boolean hitTest(int x,
                       int y)
Description copied from interface: Mirage
Returns true if this mirage contains a non-transparent pixel at the specified coordinate.

Specified by:
hitTest in interface Mirage

getSnapshot

public BufferedImage getSnapshot()
Description copied from interface: Mirage
Returns a snapshot of this mirage as a buffered image. The snapshot should not be modified by the caller.

Specified by:
getSnapshot in interface Mirage

getEstimatedMemoryUsage

public long getEstimatedMemoryUsage()
Description copied from interface: Mirage
Returns an estimate of the memory consumed by this mirage's image raster data.

Specified by:
getEstimatedMemoryUsage in interface Mirage

computeTransformedBounds

protected void computeTransformedBounds()
Compute the bounds of the base Mirage after it has been transformed.