javax.media.jai
Class UntiledOpImage

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

public abstract class UntiledOpImage
extends OpImage

A general class for single-source operations which require cobbled sources and create an image consisting of a single tile equal in location and size to the image bounds.

The output image will have a single tile, regardless of the ImageLayout settings passed to the constructor. Any specified settings for tile grid offset and tile dimensions will be replaced by the image origin and tile dimensions, respectively.

Subclasses should implement the computeImage method which requests computation of the entire image at once.

See Also:
OpImage, DCTDescriptor, DFTDescriptor, ErrorDiffusionDescriptor

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
UntiledOpImage(RenderedImage source, Map configuration, ImageLayout layout)
          Constructs an UntiledOpImage.
UntiledOpImage(Vector sources, Map configuration, ImageLayout layout)
          Constructs an UntiledOpImage.
 
Method Summary
protected abstract  void computeImage(Raster[] sources, WritableRaster dest, Rectangle destRect)
          Calculate the destination image from the source image.
 Raster computeTile(int tileX, int tileY)
          Computes a tile.
 Point[] getTileDependencies(int tileX, int tileY, int sourceIndex)
          Returns an array of points indicating the tile dependencies which in this case is the set of all tiles in the specified source image.
 Rectangle mapDestRect(Rectangle destRect, int sourceIndex)
          Returns the bounds of the indicated source image.
 Rectangle mapSourceRect(Rectangle sourceRect, int sourceIndex)
          Returns the image bounds.
 
Methods inherited from class javax.media.jai.OpImage
addTileToCache, cancelTiles, computeRect, computeRect, computesUniqueTiles, finalize, getExpandedNumBands, getFormatTags, getOperationComputeType, getTile, getTileCache, getTileCacheMetric, 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

UntiledOpImage

public UntiledOpImage(Vector sources,
                      Map configuration,
                      ImageLayout layout)
Constructs an UntiledOpImage. The image origin and dimensions, SampleModel, and ColorModel may optionally be specified by an ImageLayout object. In all cases the tile grid offset will be set to the image origin and the tile dimensions to the image dimensions. If not specified in the ImageLayout, the image origin and dimensions are set to the corresponding attributes of the first source image. Cobbling will be performed on the source(s) as needed.
Parameters:
sources - The immediate sources of this 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.
layout - an ImageLayout optionally containing the SampleModel, and ColorModel. The tile grid layout information will be overridden in order to ensure that the image has a single tile.
Throws:
IllegalArgumentException - if sources is null.
IllegalArgumentException - If sources is non-null and any object in sources is null.
IllegalArgumentException - if sources does not contain at least one element.
ClassCastException - If the first object in sources is not a RenderedImage.
Since:
JAI 1.1

UntiledOpImage

public UntiledOpImage(RenderedImage source,
                      Map configuration,
                      ImageLayout layout)
Constructs an UntiledOpImage. The image origin and dimensions, SampleModel, and ColorModel may optionally be specified by an ImageLayout object. In all cases the tile grid offset will be set to the image origin and the tile dimensions to the image dimensions. If not specified in the ImageLayout, the image origin and dimensions are set to the corresponding attributes of the source image. Cobbling will be performed on the source as needed.
Parameters:
source - a RenderedImage.
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.
layout - an ImageLayout optionally containing the SampleModel, and ColorModel. The tile grid layout information will be overridden in order to ensure that the image has a single tile.
Throws:
IllegalArgumentException - if source is null.
Since:
JAI 1.1
Method Detail

mapSourceRect

public Rectangle mapSourceRect(Rectangle sourceRect,
                               int sourceIndex)
Returns the image bounds.
Overrides:
mapSourceRect in class OpImage
Parameters:
sourceRect - the Rectangle in source coordinates (ignored).
sourceIndex - the index of the source image (ignored).
Returns:
The image bounds.

mapDestRect

public Rectangle mapDestRect(Rectangle destRect,
                             int sourceIndex)
Returns the bounds of the indicated source image.
Overrides:
mapDestRect in class OpImage
Parameters:
destRect - the Rectangle in destination coordinates (ignored).
sourceIndex - the index of the source image.
Returns:
The bounds of the indicated source image.
Throws:
IllegalArgumentException - if sourceIndex is negative or greater than the index of the last source.

computeTile

public Raster computeTile(int tileX,
                          int tileY)
Computes a tile. All sources are cobbled together and computeImage is called to produce the single output tile.
Overrides:
computeTile in class OpImage
Parameters:
tileX - The X index of the tile.
tileY - The Y index of the tile.

computeImage

protected abstract void computeImage(Raster[] sources,
                                     WritableRaster dest,
                                     Rectangle destRect)
Calculate the destination image from the source image.
Parameters:
sources - The source Rasters; should be the whole image for each source.
dest - The destination WritableRaster; should be the whole image.
destRect - The destination Rectangle; should equal the destination image bounds.
Since:
JAI 1.1

getTileDependencies

public Point[] getTileDependencies(int tileX,
                                   int tileY,
                                   int sourceIndex)
Returns an array of points indicating the tile dependencies which in this case is the set of all tiles in the specified source image.
Overrides:
getTileDependencies in class OpImage
Since:
JAI 1.1