javax.media.jai
Class ColormapOpImage

java.lang.Object
  |
  +--javax.media.jai.PlanarImage
        |
        +--javax.media.jai.OpImage
              |
              +--javax.media.jai.PointOpImage
                    |
                    +--javax.media.jai.ColormapOpImage
All Implemented Interfaces:
ImageJAI, PropertyChangeEmitter, PropertySource, RenderedImage, WritablePropertySource

public abstract class ColormapOpImage
extends PointOpImage

A class to be used to implement an operation which may conditionally be accelerated by transforming the colormap of the source image instead of its data. An instance of this class will represent the destination of a single-source point operation which may be effected by a simple transformation of the source image colormap if the ColorModels of the source and destination images are both instances of IndexColorModel. A subclass may take advantage of this capability merely by implementing transformColormap() and invoking initializeColormapOperation() as the last statement of its constructor. If the ColorModels are not IndexColorModels, the behavior is the same as if the superclass PointOpImage had been extended directly.

Since:
JAI 1.1
See Also:
IndexColorModel, PointOpImage

Fields inherited from class javax.media.jai.OpImage
cache, cobbleSources, OP_COMPUTE_BOUND, OP_IO_BOUND, OP_NETWORK_BOUND, tileCacheMetric
 
Fields inherited from class javax.media.jai.PlanarImage
colorModel, eventManager, height, minX, minY, properties, sampleModel, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width
 
Constructor Summary
ColormapOpImage(RenderedImage source, ImageLayout layout, Map configuration, boolean cobbleSources)
          Constructs a ColormapOpImage with one source image.
 
Method Summary
protected  void initializeColormapOperation()
          Method to be invoked as the last statement of a subclass constructor.
protected  boolean isColormapOperation()
          Whether the operation is performed on the colormap directly.
protected abstract  void transformColormap(byte[][] colormap)
          Transform the colormap according to the specific operation.
 
Methods inherited from class javax.media.jai.PointOpImage
computeTile, mapDestRect, mapSourceRect, permitInPlaceOperation
 
Methods inherited from class javax.media.jai.OpImage
addTileToCache, cancelTiles, computeRect, computeRect, computesUniqueTiles, finalize, getExpandedNumBands, getFormatTags, getOperationComputeType, getTile, getTileCache, getTileCacheMetric, getTileDependencies, getTileFromCache, getTiles, hasExtender, prefetchTiles, queueTiles, setTileCache, vectorize, vectorize, vectorize
 
Methods inherited from class javax.media.jai.PlanarImage
addPropertyChangeListener, addPropertyChangeListener, addSink, addSink, addSource, addTileComputationListener, copyData, copyData, copyExtendedData, createColorModel, createSnapshot, dispose, getAsBufferedImage, getAsBufferedImage, getBounds, getColorModel, getData, getData, getDefaultColorModel, getExtendedData, getGraphics, getHeight, getMaxTileX, getMaxTileY, getMaxX, getMaxY, getMinTileX, getMinTileY, getMinX, getMinY, getNumBands, getNumSources, getNumXTiles, getNumYTiles, getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames, getSampleModel, getSinks, getSource, getSourceImage, getSourceObject, getSources, getSplits, getTileComputationListeners, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileIndices, getTileRect, getTiles, getTileWidth, getWidth, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeSink, removeSink, removeSinks, removeSource, removeSources, removeTileComputationListener, setImageLayout, setProperties, setProperty, setSource, setSources, tileXToX, tileXToX, tileYToY, tileYToY, toString, wrapRenderedImage, XToTileX, XToTileX, YToTileY, YToTileY
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColormapOpImage

public ColormapOpImage(RenderedImage source,
                       ImageLayout layout,
                       Map configuration,
                       boolean cobbleSources)
Constructs a ColormapOpImage with one source image. The parameters are forwarded unmodified to the equivalent superclass constructor.
Parameters:
layout - The layout parameters of the destination image.
source - The source image.
configuration - Configurable attributes of the image including configuration variables indexed by RenderingHints.Keys and image properties indexed by Strings or CaselessStringKeys. This is simply forwarded to the superclass constructor.
cobbleSources - Indicates whether computeRect() expects contiguous sources.
Throws:
IllegalArgumentException - if source is null.
Method Detail

isColormapOperation

protected final boolean isColormapOperation()
Whether the operation is performed on the colormap directly.
Overrides:
isColormapOperation in class PointOpImage

initializeColormapOperation

protected final void initializeColormapOperation()
Method to be invoked as the last statement of a subclass constructor. The colormap acceleration flag is set appropriately and if true a new ColorModel is calculated by transforming the source colormap. This method must be invoked in the subclass constructor as it calls transformColormap() which is abstract and therefore requires that the implementing class be constructed before it may be invoked.

transformColormap

protected abstract void transformColormap(byte[][] colormap)
Transform the colormap according to the specific operation. The modification is done in place so that the parameter array will be modified. The format of the parameter array is byte[3][] wherein colormap[0], colormap[1], and colormap[2] represent the red, green, and blue colormaps, respectively.