javax.media.jai
Class NullOpImage

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

public class NullOpImage
extends PointOpImage

A trivial OpImage subclass that simply transmits its source unchanged. This may be useful when an interface requires an OpImage but another sort of RenderedImage (such as a BufferedImage or TiledImage) is available. Additionally, NullOpImage is able to make use of JAI's tile caching mechanisms.

Methods that get or set properties are implemented to forward the requests to the source image; no independent property information is stored in the NullOpImage itself.

See Also:
PointOpImage

Field Summary
protected  int computeType
           
 
Fields inherited from class javax.media.jai.OpImage
cache, cobbleSources, OP_COMPUTE_BOUND, OP_IO_BOUND, OP_NETWORK_BOUND, tileCacheMetric, tileRecycler
 
Fields inherited from class javax.media.jai.PlanarImage
colorModel, eventManager, height, minX, minY, properties, sampleModel, tileFactory, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width
 
Constructor Summary
NullOpImage(RenderedImage source, ImageLayout layout, Map configuration, int computeType)
          Constructs a NullOpImage.
NullOpImage(RenderedImage source, TileCache cache, int computeType, ImageLayout layout)
          Deprecated. as of JAI 1.1.
 
Method Summary
 boolean computesUniqueTiles()
          Returns false as NullOpImage can return via computeTile() tiles that are internally cached.
 Raster computeTile(int tileX, int tileY)
          Returns a tile for reading.
 int getOperationComputeType()
          Returns one of OP_COMPUTE_BOUND, OP_IO_BOUND, or OP_NETWORK_BOUND to indicate how the operation is likely to spend its time.
protected  Hashtable getProperties()
          Returns the properties from the source image.
 Object getProperty(String name)
          Retrieves a property from the source image by name or java.awt.Image.UndefinedProperty if the property with the specified name is not defined.
 Class getPropertyClass(String name)
          Returns the class of the specified property from the source image.
 String[] getPropertyNames()
          Returns the property names from the source image or null if no property names are recognized.
 String[] getPropertyNames(String prefix)
          Returns the property names with the supplied prefix from the source image or null if no property names are recognized.
 void removeProperty(String name)
          Removes a property from the source image by name.
protected  void setProperties(Hashtable properties)
          Set the properties Hashtable of the source image to the supplied Hashtable.
 void setProperty(String name, Object value)
          Sets a property on the source image by name.
 
Methods inherited from class javax.media.jai.PointOpImage
dispose, isColormapOperation, mapDestRect, mapSourceRect, permitInPlaceOperation
 
Methods inherited from class javax.media.jai.OpImage
addTileToCache, cancelTiles, computeRect, computeRect, createTile, getExpandedNumBands, getFormatTags, getTile, getTileCache, getTileCacheMetric, getTileDependencies, getTileFromCache, getTileRecycler, getTiles, hasExtender, mapDestPoint, mapSourcePoint, prefetchTiles, queueTiles, recycleTile, setTileCache, vectorize, vectorize, vectorize
 
Methods inherited from class javax.media.jai.PlanarImage
addPropertyChangeListener, addPropertyChangeListener, addSink, addSink, addSource, addTileComputationListener, copyData, copyData, copyExtendedData, createColorModel, createSnapshot, createWritableRaster, finalize, getAsBufferedImage, getAsBufferedImage, getBounds, getColorModel, getData, getData, getDefaultColorModel, getExtendedData, getGraphics, getHeight, getImageID, getMaxTileX, getMaxTileY, getMaxX, getMaxY, getMinTileX, getMinTileY, getMinX, getMinY, getNumBands, getNumSources, getNumXTiles, getNumYTiles, getSampleModel, getSinks, getSource, getSourceImage, getSourceObject, getSources, getSplits, getTileComputationListeners, getTileFactory, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileIndices, getTileRect, getTiles, getTileWidth, getWidth, overlapsMultipleTiles, removePropertyChangeListener, removePropertyChangeListener, removeSink, removeSink, removeSinks, removeSource, removeSources, removeTileComputationListener, setImageLayout, 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

computeType

protected int computeType
Constructor Detail

NullOpImage

public NullOpImage(RenderedImage source,
                   ImageLayout layout,
                   Map configuration,
                   int computeType)
Constructs a NullOpImage. The superclass constructor will be passed a new ImageLayout object with all of its fields filled in. The ColorModel may be overridden via the supplied ImageLayout; all other layout fields are derived from the source image. Any specified ColorModel will be used if and only if it is compatible with the source image SampleModel.
Parameters:
layout - An ImageLayout optionally specifying the image ColorModel; all other fields are ignored. This parameter may be null.
source - A RenderedImage; must not be null or a IllegalArgumentException will be thrown.
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.
computeType - A tag indicating whether the source is OpImage.OP_COMPUTE_BOUND, OpImage.OP_IO_BOUND or OpImage.OP_NETWORK_BOUND. This information is used as a hint to optimize OpImage computation.
Throws:
IllegalArgumentException - if source is null.
IllegalArgumentException - if computeType is not one of the known OP_*_BOUND values.
Since:
JAI 1.1

NullOpImage

public NullOpImage(RenderedImage source,
                   TileCache cache,
                   int computeType,
                   ImageLayout layout)
Deprecated. as of JAI 1.1.

Constructs a NullOpImage. The superclass constructor will be passed a new ImageLayout object with all of its fields filled in. The ColorModel may be overridden via the supplied ImageLayout; all other layout fields are derived from the source image. Any specified ColorModel will be used if and only if it is compatible with the source image SampleModel.
Parameters:
source - A RenderedImage; must not be null or a IllegalArgumentException will be thrown.
cache - a TileCache object to store tiles from this OpImage, or null. If null, a default cache will be used.
computeType - A tag indicating whether the source is OpImage.OP_COMPUTE_BOUND, OpImage.OP_IO_BOUND or OpImage.OP_NETWORK_BOUND. This information is used as a hint to optimize OpImage computation.
layout - An ImageLayout optionally specifying the image ColorModel; all other fields are ignored. This parameter may be null.
Throws:
IllegalArgumentException - if source is null.
IllegalArgumentException - if computeType is not one of the known OP_*_BOUND values.
Method Detail

computeTile

public Raster computeTile(int tileX,
                          int tileY)
Returns a tile for reading.
Overrides:
computeTile in class PointOpImage
Parameters:
tileX - The X index of the tile.
tileY - The Y index of the tile.
Returns:
The tile as a Raster.

computesUniqueTiles

public boolean computesUniqueTiles()
Returns false as NullOpImage can return via computeTile() tiles that are internally cached.
Overrides:
computesUniqueTiles in class OpImage

getProperties

protected Hashtable getProperties()
Returns the properties from the source image.
Overrides:
getProperties in class PlanarImage

setProperties

protected void setProperties(Hashtable properties)
Set the properties Hashtable of the source image to the supplied Hashtable.
Overrides:
setProperties in class PlanarImage

getPropertyNames

public String[] getPropertyNames()
Returns the property names from the source image or null if no property names are recognized.
Overrides:
getPropertyNames in class PlanarImage
Following copied from class: javax.media.jai.PlanarImage
Returns:
an array of Strings containing valid property names or null.

getPropertyNames

public String[] getPropertyNames(String prefix)
Returns the property names with the supplied prefix from the source image or null if no property names are recognized.
Overrides:
getPropertyNames in class PlanarImage
Following copied from class: javax.media.jai.PlanarImage
Returns:
an array of Strings giving the valid property names.
Throws:
IllegalArgumentException - If prefix is null.

getPropertyClass

public Class getPropertyClass(String name)
Returns the class of the specified property from the source image.
Overrides:
getPropertyClass in class PlanarImage
Since:
JAI 1.1

getProperty

public Object getProperty(String name)
Retrieves a property from the source image by name or java.awt.Image.UndefinedProperty if the property with the specified name is not defined.
Overrides:
getProperty in class PlanarImage
Following copied from class: javax.media.jai.PlanarImage
Parameters:
name - the name of the property to get, as a String.
Returns:
A reference to the property Object, or the value java.awt.Image.UndefinedProperty.
Throws:
IllegalArgumentException - if propertyName is null.

setProperty

public void setProperty(String name,
                        Object value)
Sets a property on the source image by name.
Overrides:
setProperty in class PlanarImage
Following copied from class: javax.media.jai.PlanarImage
Parameters:
name - a String containing the property's name.
value - the property, as a general Object.
Throws:
IllegalArgumentException - If name or value is null.

removeProperty

public void removeProperty(String name)
Removes a property from the source image by name.
Overrides:
removeProperty in class PlanarImage
Since:
JAI 1.1

getOperationComputeType

public int getOperationComputeType()
Returns one of OP_COMPUTE_BOUND, OP_IO_BOUND, or OP_NETWORK_BOUND to indicate how the operation is likely to spend its time. The answer does not affect the output of the operation, but may allow a scheduler to parallelize the computation of multiple operations more effectively. The default implementation returns OP_COMPUTE_BOUND.
Overrides:
getOperationComputeType in class OpImage