The vast and the sweeping. Modified the tile framework such that tiles no
longer provide access to their underlying image (they actually still do, but not in the normal course of affairs). This will allow us to use "trimmed" tiles which are trimmed to the smallest rectangle that contains the non-transparent pixels in a tile image, which will shrink up our components and other tiles a great deal. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1339 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AutoFringer.java,v 1.10 2002/05/03 04:12:48 mdb Exp $
|
||||
// $Id: AutoFringer.java,v 1.11 2002/05/06 18:08:32 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tile;
|
||||
|
||||
@@ -147,8 +147,8 @@ public class AutoFringer
|
||||
/**
|
||||
* Compose a FringeTile out of the various fringe images needed.
|
||||
*/
|
||||
protected Tile composeFringeTile (FringerRec[] fringers, HashMap masks,
|
||||
Random rando)
|
||||
protected Tile composeFringeTile (
|
||||
FringerRec[] fringers, HashMap masks, Random rando)
|
||||
{
|
||||
// sort the array so that higher priority fringers get drawn first
|
||||
QuickSort.sort(fringers);
|
||||
@@ -191,7 +191,6 @@ public class AutoFringer
|
||||
{
|
||||
FringeConfiguration.FringeTileSetRecord tsr =
|
||||
_fringeconf.getRandomFringe(baseset, rando);
|
||||
|
||||
int fringeset = tsr.fringe_tsid;
|
||||
|
||||
if (!tsr.mask) {
|
||||
@@ -208,7 +207,6 @@ public class AutoFringer
|
||||
img = ImageUtil.composeMaskedImage(
|
||||
(BufferedImage) _tmgr.getTile(fringeset, index).getImage(),
|
||||
(BufferedImage) _tmgr.getTile(baseset, 0).getImage());
|
||||
|
||||
masks.put(maskkey, img);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
//
|
||||
// $Id: BaseTile.java,v 1.5 2002/02/07 02:58:46 shaper Exp $
|
||||
// $Id: BaseTile.java,v 1.6 2002/05/06 18:08:32 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tile;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import com.threerings.media.tile.Tile;
|
||||
|
||||
/**
|
||||
@@ -17,17 +19,17 @@ public class BaseTile extends Tile
|
||||
* Constructs a new base tile with the specified image. Passability
|
||||
* will be assumed to be true.
|
||||
*/
|
||||
public BaseTile (Image image)
|
||||
public BaseTile (Image image, Rectangle bounds)
|
||||
{
|
||||
super(image);
|
||||
this(image, bounds, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new base tile with the specified passability.
|
||||
*/
|
||||
public BaseTile (Image image, boolean passable)
|
||||
public BaseTile (Image image, Rectangle bounds, boolean passable)
|
||||
{
|
||||
super(image);
|
||||
super(image, bounds);
|
||||
_passable = passable;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
//
|
||||
// $Id: BaseTileSet.java,v 1.9 2001/11/29 21:58:49 mdb Exp $
|
||||
// $Id: BaseTileSet.java,v 1.10 2002/05/06 18:08:32 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tile;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.media.tile.Tile;
|
||||
import com.threerings.media.tile.SwissArmyTileSet;
|
||||
|
||||
import com.threerings.miso.scene.Traverser;
|
||||
|
||||
/**
|
||||
* The base tileset extends the swiss army tileset to add support for tile
|
||||
* passability. Passability is used to determine whether {@link
|
||||
* com.threerings.miso.scene.Traverser} objects can traverse a particular
|
||||
* tile in a scene.
|
||||
* passability. Passability is used to determine whether {@link Traverser}
|
||||
* objects can traverse a particular tile in a scene.
|
||||
*/
|
||||
public class BaseTileSet extends SwissArmyTileSet
|
||||
{
|
||||
@@ -36,9 +38,11 @@ public class BaseTileSet extends SwissArmyTileSet
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected Tile createTile (int tileIndex, Image image)
|
||||
protected Tile createTile (int tileIndex, Image tilesetImage)
|
||||
{
|
||||
return new BaseTile(image, _passable[tileIndex]);
|
||||
return new BaseTile(tilesetImage,
|
||||
computeTileBounds(tileIndex, tilesetImage),
|
||||
_passable[tileIndex]);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: FringeTile.java,v 1.1 2002/04/06 03:41:58 ray Exp $
|
||||
// $Id: FringeTile.java,v 1.2 2002/05/06 18:08:32 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tile;
|
||||
|
||||
@@ -21,7 +21,8 @@ public class FringeTile extends Tile
|
||||
*/
|
||||
public FringeTile (Image img)
|
||||
{
|
||||
super(img);
|
||||
super(img, new Rectangle(
|
||||
0, 0, img.getWidth(null), img.getHeight(null)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,13 +37,10 @@ public class FringeTile extends Tile
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void paint (Graphics2D gfx, Shape dest)
|
||||
public void paint (Graphics2D gfx, int x, int y)
|
||||
{
|
||||
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++) {
|
||||
|
||||
Reference in New Issue
Block a user