com.threerings.media.tile
Class SimpleCachingImageProvider

java.lang.Object
  extended by com.threerings.media.tile.SimpleCachingImageProvider
All Implemented Interfaces:
ImageProvider

public abstract class SimpleCachingImageProvider
extends Object
implements ImageProvider

An image provider that can be used by command line tools to load images and provide them to tilesets when doing things like preprocessing tileset images.


Field Summary
protected  Map<String,BufferedImage> _cache
           
 
Constructor Summary
SimpleCachingImageProvider()
           
 
Method Summary
 Mirage getTileImage(String path, Rectangle bounds, Colorization[] zations)
          Obtains the tile image with the specified path in the form of a Mirage.
 BufferedImage getTileSetImage(String path, Colorization[] zations)
          Returns the raw tileset image with the specified path.
protected abstract  BufferedImage loadImage(String path)
          Derived classes must implement this method to actually load the raw source images.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_cache

protected Map<String,BufferedImage> _cache
Constructor Detail

SimpleCachingImageProvider

public SimpleCachingImageProvider()
Method Detail

getTileSetImage

public BufferedImage getTileSetImage(String path,
                                     Colorization[] zations)
Description copied from interface: ImageProvider
Returns the raw tileset image with the specified path.

Specified by:
getTileSetImage in interface ImageProvider
Parameters:
path - the path that identifies the desired image (corresponds to the image path from the tileset).
zations - if non-null, colorizations to apply to the source image before returning it.

getTileImage

public Mirage getTileImage(String path,
                           Rectangle bounds,
                           Colorization[] zations)
Description copied from interface: ImageProvider
Obtains the tile image with the specified path in the form of a Mirage. It should be cropped from the tileset image identified by the supplied path.

Specified by:
getTileImage in interface ImageProvider
Parameters:
path - the path that identifies the desired image (corresponds to the image path from the tileset).
bounds - if non-null, the region of the image to be returned as a mirage. If null, the entire image should be returned.
zations - if non-null, colorizations to apply to the image before converting it into a mirage.

loadImage

protected abstract BufferedImage loadImage(String path)
                                    throws IOException
Derived classes must implement this method to actually load the raw source images.

Throws:
IOException