A whole lot of widening, refactoring, thinking, rethinking and fiddling around

for what ultimately boils down adding this method to BundledComponentRepository:

    @Override // from IMImageProvider
    public Mirage getTileImage (String path, Rectangle bounds, Colorization[] zations)
    {
        // we don't need our images prepared for screen rendering
        BufferedImage src = _imgr.getImage(getImageKey(path), zations);
        if (bounds != null) {
            src = src.getSubimage(bounds.x, bounds.y, bounds.width, bounds.height);
        }
        return new BufferedMirage(src);
    }

So much fun to revisit code I wrote six years ago.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@283 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Michael Bayne
2007-08-03 22:04:04 +00:00
parent bbd5dd284e
commit 069fe85c70
11 changed files with 390 additions and 486 deletions
@@ -27,11 +27,10 @@ import java.awt.image.BufferedImage;
import com.threerings.geom.GeomUtil;
/**
* A uniform tileset is one that is composed of tiles that are all the
* same width and height and are arranged into rows, with each row having
* the same number of tiles except possibly the final row which can
* contain the same as or less than the number of tiles contained by the
* previous rows.
* A uniform tileset is one that is composed of tiles that are all the same width and height and
* are arranged into rows, with each row having the same number of tiles except possibly the final
* row which can contain the same as or less than the number of tiles contained by the previous
* rows.
*/
public class UniformTileSet extends TileSet
{
@@ -44,6 +43,14 @@ public class UniformTileSet extends TileSet
return perRow * perCol;
}
// documentation inherited
public Rectangle computeTileBounds (int tileIndex, Rectangle bounds)
{
BufferedImage tsimg = getRawTileSetImage();
GeomUtil.getTile(tsimg.getWidth(), tsimg.getHeight(), _width, _height, tileIndex, bounds);
return bounds;
}
/**
* Specifies the width of the tiles in this tileset.
*/
@@ -76,14 +83,6 @@ public class UniformTileSet extends TileSet
return _height;
}
// documentation inherited
protected Rectangle computeTileBounds (int tileIndex)
{
BufferedImage tsimg = getRawTileSetImage();
return GeomUtil.getTile(tsimg.getWidth(), tsimg.getHeight(),
_width, _height, tileIndex);
}
// documentation inherited
protected void toString (StringBuilder buf)
{