com.hdcookbook.grin.util
Class ImageManager

java.lang.Object
  extended by com.hdcookbook.grin.util.ImageManager

public class ImageManager
extends java.lang.Object

This class manages a set of images. It loads and flushes them as needed.

Author:
Bill Foote (http://jovial.com)

Method Summary
static void getImage(ManagedImage im)
          This is like getImage(String), but for the case where you already have the ManagedImage instance.
static ManagedImage getImage(java.lang.String name)
          Get an image.
static ManagedImage getImage(java.net.URL url)
          Get an image from a URL.
static void ungetImage(ManagedImage im)
          Called when an image acquired with getImage is no longer needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getImage

public static ManagedImage getImage(java.lang.String name)
Get an image. Each call to getImage should be balanced by a call to ungetImage when you no longer need the image. Image instances are shared, so this class does reference counting. See the ManagedImage contract for more details.

ImageManager first looks within known mosaics, then looks for an individual image file.

See Also:
ungetImage(com.hdcookbook.grin.util.ManagedImage), ManagedImage

getImage

public static ManagedImage getImage(java.net.URL url)
Get an image from a URL. Any image mosaic won't be consulted; the image will be taken directly from whatever the URL refers to. Each call to getImage should be balanced by a call to ungetImage when you no longer need the image. Image instances are shared, so this class does reference counting. See the ManagedImage contract for more details.

ImageManager first looks within known mosaics, then looks for an individual image file.

See Also:
ungetImage(com.hdcookbook.grin.util.ManagedImage), ManagedImage

getImage

public static void getImage(ManagedImage im)
This is like getImage(String), but for the case where you already have the ManagedImage instance. It just increments the reference count, without needing to do a hash table lookup. See the ManagedImage contract for more details.

Throws:
java.lang.IllegalStateException - if im.isReferenced() is false
See Also:
ManagedImage

ungetImage

public static void ungetImage(ManagedImage im)
Called when an image acquired with getImage is no longer needed. See the ManagedImage contract for more details.

See Also:
getImage(java.lang.String), ManagedImage