com.threerings.cast.bundle
Class BundledComponentRepository.ResourceBundleProvider

java.lang.Object
  extended by com.threerings.media.tile.IMImageProvider
      extended by com.threerings.cast.bundle.BundledComponentRepository.ResourceBundleProvider
All Implemented Interfaces:
FrameProvider, ImageDataProvider, ImageProvider
Enclosing class:
BundledComponentRepository

protected class BundledComponentRepository.ResourceBundleProvider
extends IMImageProvider
implements ImageDataProvider, FrameProvider

Instances of these provide images to our component action tilesets and frames to our components.


Field Summary
protected  ResourceBundle _bundle
          The resource bundle from which we obtain image data.
protected  Map<String,TileSet> _setcache
          Cache of tilesets loaded from our bundle.
 
Fields inherited from class com.threerings.media.tile.IMImageProvider
_dprov, _imgr, _rset
 
Constructor Summary
BundledComponentRepository.ResourceBundleProvider(ImageManager imgr, ResourceBundle bundle)
          Constructs an instance that will obtain image data from the specified resource bundle.
 
Method Summary
 String getFramePath(CharacterComponent component, String action, String type, Set<String> existentPaths)
          Returns the file path of the animation frames (in the eight sprite directions) for the specified action of the specified component.
 ActionFrames getFrames(CharacterComponent component, String action, String type)
          Returns the animation frames (in the eight sprite directions) for the specified action of the specified component.
 String getIdent()
          Returns a string identifier for this image data provider which wil be used to differentiate it from other providers and thus should be unique.
 Mirage getTileImage(String path, Rectangle bounds, Colorization[] zations)
          Obtains the tile image with the specified path in the form of a Mirage.
 BufferedImage loadImage(String path)
          Returns the image at the specified path.
protected  String makePath(CharacterComponent component, String action, String type)
           
 
Methods inherited from class com.threerings.media.tile.IMImageProvider
getImageKey, getTileSetImage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_bundle

protected ResourceBundle _bundle
The resource bundle from which we obtain image data.


_setcache

protected Map<String,TileSet> _setcache
Cache of tilesets loaded from our bundle.

Constructor Detail

BundledComponentRepository.ResourceBundleProvider

public BundledComponentRepository.ResourceBundleProvider(ImageManager imgr,
                                                         ResourceBundle bundle)
Constructs an instance that will obtain image data from the specified resource bundle.

Method Detail

getIdent

public String getIdent()
Description copied from interface: ImageDataProvider
Returns a string identifier for this image data provider which wil be used to differentiate it from other providers and thus should be unique.

Specified by:
getIdent in interface ImageDataProvider

loadImage

public BufferedImage loadImage(String path)
                        throws IOException
Description copied from interface: ImageDataProvider
Returns the image at the specified path.

Specified by:
loadImage in interface ImageDataProvider
Throws:
IOException

getFrames

public ActionFrames getFrames(CharacterComponent component,
                              String action,
                              String type)
Description copied from interface: FrameProvider
Returns the animation frames (in the eight sprite directions) for the specified action of the specified component. May return null if the specified action does not exist for the specified component.

Specified by:
getFrames in interface FrameProvider

getFramePath

public String getFramePath(CharacterComponent component,
                           String action,
                           String type,
                           Set<String> existentPaths)
Description copied from interface: FrameProvider
Returns the file path of the animation frames (in the eight sprite directions) for the specified action of the specified component. May return a path to the default action or null if the specified action does not exist for the specified component.

Specified by:
getFramePath in interface FrameProvider
existentPaths - the set of all paths for which there are valid frames.

makePath

protected String makePath(CharacterComponent component,
                          String action,
                          String type)

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
Overrides:
getTileImage in class IMImageProvider
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.