com.threerings.media.tile.util
Class TileSetTrimmer
java.lang.Object
com.threerings.media.tile.util.TileSetTrimmer
public class TileSetTrimmer
- extends Object
Contains routines for trimming the images from an existing tileset
which means that each tile is converted to an image that contains the
smallest rectangular region of the original image that contains all
non-transparent pixels. These trimmed images are then written out to a
single image, packed together left to right.
|
Nested Class Summary |
static interface |
TileSetTrimmer.TrimMetricsReceiver
Used to communicate the metrics of the trimmed tiles back to the
caller so that they can do what they like with them. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TileSetTrimmer
public TileSetTrimmer()
trimTileSet
public static void trimTileSet(TileSet source,
OutputStream destImage,
TileSetTrimmer.TrimMetricsReceiver tmr)
throws IOException
- Convenience function to trim the tile set using FastImageIO to save the result.
- Throws:
IOException
trimTileSet
public static void trimTileSet(TileSet source,
OutputStream destImage,
TileSetTrimmer.TrimMetricsReceiver tmr,
String imgFormat)
throws IOException
- Generates a trimmed tileset image from the supplied source
tileset. The source tileset must be configured with an image
provider so that the tile images can be obtained. The tile images
will be trimmed and a new tileset image generated and written to
the
destImage output stream argument.
- Parameters:
source - the source tileset.destImage - an output stream to which the new trimmed image
will be written.tmr - a callback object that will be used to inform the caller
of the trimmed tile metrics.imgFormat - the format in which to write the image file - or if null, use FastImageIO.
- Throws:
IOException