|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.tile.TileSet
com.threerings.media.tile.TrimmedObjectTileSet
public class TrimmedObjectTileSet
An object tileset in which the objects have been trimmed to the smallest possible images that still contain all of their non-transparent pixels. The objects' origins are adjusted so that the objects otherwise behave exactly as the untrimmed objects and are thus interchangeable (and more memory efficient).
| Nested Class Summary | |
|---|---|
protected static class |
TrimmedObjectTileSet.Bits
Extra bits related to object tiles. |
| Nested classes/interfaces inherited from class com.threerings.media.tile.TileSet |
|---|
TileSet.Colorizer |
| Field Summary | |
|---|---|
protected TrimmedObjectTileSet.Bits[] |
_bits
Extra bits relating to our objects. |
protected Rectangle[] |
_bounds
Contains the width and height of each object tile and the offset into the tileset image of their image data. |
protected Rectangle[] |
_ometrics
Contains the origin offset for each object tile and the object footprint width and height (in tile units). |
protected String[] |
_zations
Colorization classes that apply to our objects. |
| Fields inherited from class com.threerings.media.tile.TileSet |
|---|
_atiles, _cacheStatThrottle, _imagePath, _improv, _key, _name |
| Constructor Summary | |
|---|---|
TrimmedObjectTileSet()
|
|
| Method Summary | |
|---|---|
Rectangle |
computeTileBounds(int tileIndex,
Rectangle bounds)
Computes and fills in the bounds for the specified tile based on the mechanism used by the derived class to do such things. |
protected Tile |
createTile()
Creates a blank tile of the appropriate type for this tileset. |
int |
getBaseHeight(int tileIdx)
Returns the base height for the specified object index. |
int |
getBaseWidth(int tileIdx)
Returns the base width for the specified object index. |
String[] |
getColorizations()
Returns the colorization classes that should be used to recolor objects in this tileset. |
protected Colorization[] |
getColorizations(int tileIndex,
TileSet.Colorizer rizer)
Returns colorizations for the specified tile image. |
String[] |
getConstraints(int tileIdx)
Returns the constraints associated with the specified tile index, or null if
the object has no associated constraints. |
int |
getSpotOrient(int tileIdx)
Returns the orientation of the spot associated with the specified tile index, or -1 if the object has no associated spot. |
int |
getTileCount()
Returns the number of tiles in the tileset. |
int |
getXSpot(int tileIdx)
Returns the x coordinate of the spot associated with the specified tile index. |
int |
getYSpot(int tileIdx)
Returns the y coordinate of the spot associated with the specified tile index. |
boolean |
hasConstraint(int tileIdx,
String constraint)
Checks whether the tile at the specified index has the given constraint. |
protected void |
initTile(Tile tile,
int tileIndex,
Colorization[] zations)
Initializes the supplied tile. |
protected void |
toString(StringBuilder buf)
Derived classes can override this, calling super.toString(buf) and then
appending additional information to the buffer. |
static TrimmedObjectTileSet |
trimObjectTileSet(ObjectTileSet source,
OutputStream destImage)
Convenience function to trim the tile set to a file using FastImageIO. |
static TrimmedObjectTileSet |
trimObjectTileSet(ObjectTileSet source,
OutputStream destImage,
String imgFormat)
Creates a trimmed object tileset from the supplied source object tileset. |
| Methods inherited from class com.threerings.media.tile.TileSet |
|---|
checkTileIndex, clone, clone, getImagePath, getName, getRawTileImage, getRawTileSetImage, getTile, getTile, getTile, getTileMirage, getTileMirage, getTileMirages, reportCachePerformance, setImagePath, setImageProvider, setName, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Rectangle[] _bounds
protected Rectangle[] _ometrics
protected TrimmedObjectTileSet.Bits[] _bits
protected String[] _zations
| Constructor Detail |
|---|
public TrimmedObjectTileSet()
| Method Detail |
|---|
public int getTileCount()
TileSet
getTileCount in class TileSet
public Rectangle computeTileBounds(int tileIndex,
Rectangle bounds)
TileSet
computeTileBounds in class TileSettileIndex - the index of the tile whose bounds are to be computed.bounds - the rectangle object into which to fill the bounds.
public int getXSpot(int tileIdx)
public int getYSpot(int tileIdx)
public int getSpotOrient(int tileIdx)
-1 if the object has no associated spot.
public String[] getConstraints(int tileIdx)
null if
the object has no associated constraints.
public boolean hasConstraint(int tileIdx,
String constraint)
public String[] getColorizations()
RecolorableTileSet
getColorizations in interface RecolorableTileSetpublic int getBaseWidth(int tileIdx)
getBaseWidth in interface BaseSizableTileSetpublic int getBaseHeight(int tileIdx)
getBaseHeight in interface BaseSizableTileSet
protected Colorization[] getColorizations(int tileIndex,
TileSet.Colorizer rizer)
TileSetTileSet.clone(Colorization[]),
however derived classes may have dynamic colorization policies that look up colorization
assignments from the supplied colorizer.
getColorizations in class TileSetprotected Tile createTile()
TileSet
createTile in class TileSet
protected void initTile(Tile tile,
int tileIndex,
Colorization[] zations)
TileSetsuper.initTile().
initTile in class TileSettile - the tile to initialize.tileIndex - the index of the tile.zations - the colorizations to be used when generating the tile image.protected void toString(StringBuilder buf)
TileSetsuper.toString(buf) and then
appending additional information to the buffer.
toString in class TileSet
public static TrimmedObjectTileSet trimObjectTileSet(ObjectTileSet source,
OutputStream destImage)
throws IOException
IOException
public static TrimmedObjectTileSet trimObjectTileSet(ObjectTileSet source,
OutputStream destImage,
String imgFormat)
throws IOException
destImage parameter is actually stored on the file system. If imgFormat is
null, uses FastImageIO to save the file. See TileSetTrimmer.trimTileSet(com.threerings.media.tile.TileSet, java.io.OutputStream, com.threerings.media.tile.util.TileSetTrimmer.TrimMetricsReceiver) for further
information.
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||