com.threerings.opengl.util
Class ImageCache

java.lang.Object
  extended by com.threerings.opengl.util.ResourceCache
      extended by com.threerings.opengl.util.ImageCache

public class ImageCache
extends ResourceCache

A cache for images.


Nested Class Summary
protected static class ImageCache.ImageKey
          Identifies a cached image.
 
Nested classes/interfaces inherited from class com.threerings.opengl.util.ResourceCache
ResourceCache.CachedResource<T>, ResourceCache.Subcache<K,V>
 
Field Summary
protected  ResourceCache.Subcache<ImageCache.ImageKey,BufferedImage> _buffered
          The buffered image subcache.
protected  ResourceCache.Subcache<ImageCache.ImageKey,Image> _images
          The GUI image subcache.
 
Fields inherited from class com.threerings.opengl.util.ResourceCache
_checkTimestamps, _ctx
 
Constructor Summary
ImageCache(GlContext ctx, boolean checkTimestamps)
          Creates a new image cache.
 
Method Summary
 void clear()
          Clears the cache, forcing resources to be reloaded.
 BufferedImage getBufferedImage(String path, Colorization... zations)
          Retrieves a buffered image from the cache.
 Image getImage(String path, Colorization... zations)
          Retrieves a GUI image from the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_images

protected ResourceCache.Subcache<ImageCache.ImageKey,Image> _images
The GUI image subcache.


_buffered

protected ResourceCache.Subcache<ImageCache.ImageKey,BufferedImage> _buffered
The buffered image subcache.

Constructor Detail

ImageCache

public ImageCache(GlContext ctx,
                  boolean checkTimestamps)
Creates a new image cache.

Parameters:
checkTimestamps - if true, check the last-modified timestamp of each resource file when we retrieve it from the cache, reloading the resource if the file has been modified externally.
Method Detail

getImage

public Image getImage(String path,
                      Colorization... zations)
Retrieves a GUI image from the cache.


getBufferedImage

public BufferedImage getBufferedImage(String path,
                                      Colorization... zations)
Retrieves a buffered image from the cache.


clear

public void clear()
Clears the cache, forcing resources to be reloaded.