javax.media.jai
Class WarpOpImage

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

public abstract class WarpOpImage
extends GeometricOpImage

A general implementation of image warping, and a superclass for specific image warping operations.

The image warp is specified by a Warp object and an Interpolation object.

Subclasses of WarpOpImage may choose whether they wish to implement the cobbled or non-cobbled variant of computeRect by means of the cobbleSources constructor parameter. The class comments for OpImage provide more information about how to override computeRect.

See Also:
OpImage, Warp, Interpolation

Field Summary
protected  Warp warp
          The Warp object describing the backwards pixel map.
 
Fields inherited from class javax.media.jai.GeometricOpImage
computableBounds, extender, interp
 
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
WarpOpImage(RenderedImage source, ImageLayout layout, Map configuration, boolean cobbleSources, BorderExtender extender, Interpolation interp, Warp warp)
          Constructor.
 
Method Summary
protected  Rectangle backwardMapRect(Rectangle destRect, int sourceIndex)
          Returns the minimum bounding box of the region of the specified source to which a particular Rectangle of the destination will be mapped.
 Raster computeTile(int tileX, int tileY)
          Computes a tile.
protected  Rectangle forwardMapRect(Rectangle sourceRect, int sourceIndex)
          Returns the minimum bounding box of the region of the destination to which a particular Rectangle of the specified source will be mapped.
 int getBottomPadding()
          Deprecated. as of JAI 1.1.
 int getLeftPadding()
          Deprecated. as of JAI 1.1.
 int getRightPadding()
          Deprecated. as of JAI 1.1.
 int getTopPadding()
          Deprecated. as of JAI 1.1.
 
Methods inherited from class javax.media.jai.GeometricOpImage
getBorderExtender, getInterpolation, mapDestRect, mapSourceRect
 
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
 

Field Detail

warp

protected Warp warp
The Warp object describing the backwards pixel map. It can not be null.
Constructor Detail

WarpOpImage

public WarpOpImage(RenderedImage source,
                   ImageLayout layout,
                   Map configuration,
                   boolean cobbleSources,
                   BorderExtender extender,
                   Interpolation interp,
                   Warp warp)
Constructor.

The image's layout is encapsulated in the layout argument. The user-supplied layout values supersedes the default settings. Any layout setting not specified by the user will take the corresponding value of the source image's layout.

Parameters:
layout - The layout of this image.
source - The source image; can not be null.
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 - A boolean indicating whether computeRect() expects contiguous sources. To use the default implementation of warping contained in this class, set cobbleSources to false.
extender - A BorderExtender, or null.
interp - The Interpolation object describing the interpolation method.
warp - The Warp object describing the warp.
Throws:
IllegalArgumentException - if source is null.
IllegalArgumentException - if combining the source bounds with the layout parameter results in negative output width or height.
IllegalArgumentException - If warp is null.
Since:
JAI 1.1
Method Detail

getLeftPadding

public int getLeftPadding()
Deprecated. as of JAI 1.1.

Returns the number of samples required to the left of the center.
Returns:
The left padding factor.

getRightPadding

public int getRightPadding()
Deprecated. as of JAI 1.1.

Returns the number of samples required to the right of the center.
Returns:
The right padding factor.

getTopPadding

public int getTopPadding()
Deprecated. as of JAI 1.1.

Returns the number of samples required above the center.
Returns:
The top padding factor.

getBottomPadding

public int getBottomPadding()
Deprecated. as of JAI 1.1.

Returns the number of samples required below the center.
Returns:
The bottom padding factor.

forwardMapRect

protected Rectangle forwardMapRect(Rectangle sourceRect,
                                   int sourceIndex)
Returns the minimum bounding box of the region of the destination to which a particular Rectangle of the specified source will be mapped.
Overrides:
forwardMapRect in class GeometricOpImage
Parameters:
sourceRect - the Rectangle in source coordinates.
sourceIndex - the index of the source image.
Returns:
a Rectangle indicating the destination bounding box, or null if the bounding box is unknown.
Throws:
IllegalArgumentException - if sourceIndex is negative or greater than the index of the last source.
IllegalArgumentException - if sourceRect is null.
Since:
JAI 1.1

backwardMapRect

protected Rectangle backwardMapRect(Rectangle destRect,
                                    int sourceIndex)
Returns the minimum bounding box of the region of the specified source to which a particular Rectangle of the destination will be mapped.
Overrides:
backwardMapRect in class GeometricOpImage
Parameters:
destRect - the Rectangle in destination coordinates.
sourceIndex - the index of the source image.
Returns:
a Rectangle indicating the source bounding box, or null if the bounding box is unknown.
Throws:
IllegalArgumentException - if sourceIndex is negative or greater than the index of the last source.
IllegalArgumentException - if destRect is null.
Since:
JAI 1.1

computeTile

public Raster computeTile(int tileX,
                          int tileY)
Computes a tile. A new WritableRaster is created to represent the requested tile. Its width and height equals to this image's tile width and tile height respectively. This method assumes that the requested tile either intersects or is within the bounds of this image.

Whether or not this method performs source cobbling is determined by the cobbleSources variable set at construction time. If cobbleSources is true, cobbling is performed on the source for areas that intersect multiple tiles, and computeRect(Raster[], WritableRaster, Rectangle) is called to perform the actual computation. Otherwise, computeRect(PlanarImage[], WritableRaster, Rectangle) is called to perform the actual computation.

Overrides:
computeTile in class GeometricOpImage
Parameters:
tileX - The X index of the tile.
tileY - The Y index of the tile.
Returns:
The tile as a Raster.