edu.stanford.hci.r3.util.graphics
Class ImageCache

java.lang.Object
  extended by edu.stanford.hci.r3.util.graphics.ImageCache

public class ImageCache
extends java.lang.Object

This software is distributed under the BSD License.


Nested Class Summary
 class ImageCache.ImageObject
           
 
Method Summary
 void addBufferedImageToCache(java.io.File pathToImage, java.awt.image.BufferedImage bImg)
          Use this only if you need to explicitly add something to the cache.
 java.awt.image.BufferedImage getBufferedImage(java.io.File pathToImage)
          Normally, just call this function to get a BufferedImage and put it in the cache.
static ImageCache getInstance()
           
 PlanarImage getPlanarImage(java.io.File pathToImage)
           
static java.awt.image.BufferedImage loadBufferedImage(java.io.File path)
           
static java.awt.image.BufferedImage loadBufferedImage(java.net.URL resource)
           
static PlanarImage loadPlanarImage(java.io.File path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ImageCache getInstance()

loadBufferedImage

public static java.awt.image.BufferedImage loadBufferedImage(java.io.File path)
Parameters:
path -
Returns:

loadBufferedImage

public static java.awt.image.BufferedImage loadBufferedImage(java.net.URL resource)
Parameters:
resource - Allows you to get images from the JAR.
Returns:

loadPlanarImage

public static PlanarImage loadPlanarImage(java.io.File path)
Parameters:
path -
Returns:

addBufferedImageToCache

public void addBufferedImageToCache(java.io.File pathToImage,
                                    java.awt.image.BufferedImage bImg)
Use this only if you need to explicitly add something to the cache. Usually, you do NOT need to use this function.

Parameters:
File -

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage(java.io.File pathToImage)
Normally, just call this function to get a BufferedImage and put it in the cache. Set your hard references to null when you are done.

Parameters:
pathToImage -
Returns:

getPlanarImage

public PlanarImage getPlanarImage(java.io.File pathToImage)
Parameters:
pathToImage -
Returns:

Copyright 2006 Stanford University