com.threerings.media.tile
Class TrimmedTile

java.lang.Object
  extended by com.threerings.media.tile.Tile
      extended by com.threerings.media.tile.TrimmedTile

public class TrimmedTile
extends Tile

Behaves just like a regular tile, but contains a "trimmed" image which is one where the source image has been trimmed to the smallest rectangle that contains all the non-transparent pixels of the original image.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.media.tile.Tile
Tile.Key
 
Field Summary
protected  Rectangle _tbounds
          Our extra trimmed image dimension information.
 
Fields inherited from class com.threerings.media.tile.Tile
_mirage, _totalTileMemory, key
 
Constructor Summary
TrimmedTile()
           
 
Method Summary
 int getHeight()
          Returns the height of this tile.
 void getTrimmedBounds(Rectangle tbounds)
          Fills in the bounds of the trimmed image within the coordinate system defined by the complete virtual tile.
 int getWidth()
          Returns the width of this tile.
 boolean hitTest(int x, int y)
          Returns true if the specified coordinates within this tile contains a non-transparent pixel.
 void paint(Graphics2D gfx, int x, int y)
          Render the tile image at the specified position in the given graphics context.
 void setTrimmedBounds(Rectangle tbounds)
          Sets the trimmed bounds of this tile.
protected  void toString(StringBuilder buf)
          This should be overridden by derived classes (which should be sure to call super.toString()) to append the derived class specific tile information to the string buffer.
 
Methods inherited from class com.threerings.media.tile.Tile
finalize, getEstimatedMemoryUsage, setImage, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_tbounds

protected Rectangle _tbounds
Our extra trimmed image dimension information.

Constructor Detail

TrimmedTile

public TrimmedTile()
Method Detail

setTrimmedBounds

public void setTrimmedBounds(Rectangle tbounds)
Sets the trimmed bounds of this tile.

Parameters:
tbounds - contains the width and height of the untrimmed tile, but the x and y offset of the trimmed tile image in the original untrimmed tile image.

getWidth

public int getWidth()
Description copied from class: Tile
Returns the width of this tile.

Overrides:
getWidth in class Tile

getHeight

public int getHeight()
Description copied from class: Tile
Returns the height of this tile.

Overrides:
getHeight in class Tile

paint

public void paint(Graphics2D gfx,
                  int x,
                  int y)
Description copied from class: Tile
Render the tile image at the specified position in the given graphics context.

Overrides:
paint in class Tile

getTrimmedBounds

public void getTrimmedBounds(Rectangle tbounds)
Fills in the bounds of the trimmed image within the coordinate system defined by the complete virtual tile.


hitTest

public boolean hitTest(int x,
                       int y)
Description copied from class: Tile
Returns true if the specified coordinates within this tile contains a non-transparent pixel.

Overrides:
hitTest in class Tile

toString

protected void toString(StringBuilder buf)
Description copied from class: Tile
This should be overridden by derived classes (which should be sure to call super.toString()) to append the derived class specific tile information to the string buffer.

Overrides:
toString in class Tile