org.cdlib.xtf.saxonExt.image
Class ImageCache

Object
  extended by Cache<K,V>
      extended by GeneratingCache<String,BufferedImage>
          extended by ImageCache

 class ImageCache
extends GeneratingCache<String,BufferedImage>

Maintain a cache of palette-mapped images used for image highlighting.

Author:
Martin Haye

Nested Class Summary
 
Nested classes/interfaces inherited from class Cache
Cache.ListEntry, Cache.NullIterator
 
Field Summary
private  int outColorBase
           
 
Fields inherited from class Cache
ageList, keyMap
 
Constructor Summary
ImageCache(int outColorBase)
          Construct the cache
 
Method Summary
protected  BufferedImage generate(String filename)
          Read in and map an image
private  BufferedImage remapPalette(BufferedImage inImg)
          Remap the colors in the given image, creating space for highlight versions of the colors.
 
Methods inherited from class GeneratingCache
addDependency, find
 
Methods inherited from class Cache
cleanup, clear, dependenciesValid, getDependencies, has, lastSet, logAction, remove, size
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outColorBase

private int outColorBase
Constructor Detail

ImageCache

ImageCache(int outColorBase)
Construct the cache

Method Detail

generate

protected BufferedImage generate(String filename)
                          throws Exception
Read in and map an image

Specified by:
generate in class GeneratingCache<String,BufferedImage>
Parameters:
filename - The key to generate a value for.
Returns:
The value for that key
Throws:
Exception - If a value cannot be generated for any reason.

remapPalette

private BufferedImage remapPalette(BufferedImage inImg)
                            throws DynamicError
Remap the colors in the given image, creating space for highlight versions of the colors.

Parameters:
inImg - The image to remap
Returns:
A new image with reduced and normalized palette
Throws:
DynamicError