FringeTile- a Tile object that may contain multiple images.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1203 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2002-04-06 03:41:58 +00:00
parent d4df933e28
commit 3474c9c199
@@ -0,0 +1,56 @@
//
// $Id: FringeTile.java,v 1.1 2002/04/06 03:41:58 ray Exp $
package com.threerings.miso.tile;
import java.awt.Image;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.Rectangle;
import java.util.ArrayList;
import com.threerings.media.tile.Tile;
/**
* A fringe tile may be composed of multiple images.
*/
public class FringeTile extends Tile
{
/**
* Construct a fringe tile with the specified image.
*/
public FringeTile (Image img)
{
super(img);
}
/**
* Add another image to this FringeTile.
*/
public void addExtraImage (Image img)
{
if (_extras == null) {
_extras = new ArrayList();
}
_extras.add(img);
}
// documentation inherited
public void paint (Graphics2D gfx, Shape dest)
{
Rectangle bounds = dest.getBounds();
int x = bounds.x;
int y = bounds.y;
gfx.drawImage(_image, x, y, null);
if (_extras != null) {
int size = _extras.size();
for (int ii=0; ii < size; ii++) {
gfx.drawImage((Image) _extras.get(ii), x, y, null);
}
}
}
/** Extra fringe images beyond the one stored in our superclass. */
protected ArrayList _extras = null;
}