javax.media.jai
Class RenderedOp

java.lang.Object
  |
  +--javax.media.jai.PlanarImage
        |
        +--javax.media.jai.RenderedOp
All Implemented Interfaces:
EventListener, ImageJAI, OperationNode, PropertyChangeEmitter, PropertyChangeListener, PropertySource, RenderedImage, Serializable, WritablePropertySource
Direct Known Subclasses:
RemoteRenderedOp

public class RenderedOp
extends PlanarImage
implements OperationNode, PropertyChangeListener, Serializable

A node in a rendered imaging chain. A RenderedOp stores an operation name, a ParameterBlock containing sources and parameters, and a RenderingHints containing hints which may be used in rendering the node. A set of nodes may be joined together via the source Vectors within their respective ParameterBlocks to form a directed acyclic graph (DAG). The topology, i.e., connectivity, of the graph may be altered by changing the node's sources. The operation name, parameters, and rendering hints may also be changed.

Such chains are useful for example as arguments to a RemoteImage; they convey the structure of an imaging chain in a compact representation and at a suitably high level of abstraction to allow the server some leeway in materializing the results. They are also useful in that a chain may be manipulated dynamically and rendered multiple times. Thus for example the same chain of operations may be applied to different images or the parameters of certain operations in a chain may be modified interactively.

A RenderedOp may be constructed directly as, for example,

 
 ParameterBlock pb =
     (new ParameterBlock()).add("SomeFile.tif");
 RenderedOp node = new RenderedOp("fileload", pb, null);
 
 
or via the create or createNS() methods defined in the JAI class. The difference between direct construction of a node and creation via a convenience method is that in the latter case:
  1. It is verified that the operation supports the rendered mode.
  2. Using the validateArguments() method of the associated OperationDescriptor, the arguments (sources and parameters) are validated as being compatible with the specified operation.
  3. Global RenderingHints maintained by the JAI instance are merged with the local RenderingHints with the local hints taking precedence.
  4. If the operation is defined to be "immediate" (the isImmediate() method of the corresponding OperationDescriptor returns true) then the node is rendered.

When a chain of nodes is rendered by any means a "parallel" chain of RenderedImages is created. Each node in the chain of RenderedOps corresponds to a node in the chain of RenderedImages. RenderedImage methods invoked on the RenderedOp are in general forwarded to the associated RenderedImage which is referred to as the rendering of the node.

The translation between RenderedOp chains and RenderedImage (usually OpImage) chains makes use of two levels of indirection provided by the OperationRegistry and RenderedImageFactory (RIF) facilities. First, the local OperationRegistry is used to map the operation name into a RIF. This RIF then constructs a RenderedImage (usually an OpImage) which does the actual image data processing. The local OperationRegistry is used in order to take advantage of the best possible implementation of the operation, e.g., RIFs that provide acceleration for certain cases or RIFs that are known to a server without having to burden the client.

A node may be rendered explicitly by invoking the method getRendering() which also returns the rendering of the node. A node may be rendered implicitly by invoking any method defined in the RenderedImage interface. A node may also be rendered implicitly by invoking any method the execution of which

The current rendering may be obtained without forcing the rendering of an unrendered node via the method getCurrentRendering(). A node may also be re-rendered via getNewRendering() which regenerates the rendering from the existing set of sources, parameters, and hints.

A rendering of a node may also be obtained by means of the createInstance() method. This method returns a PlanarImage rendering without marking the node as having been rendered. If the node is not marked as rendered then it will not fire RenderingChangeEvents as described below.

RenderedOp nodes may participate in Java Bean-style events. The PropertyChangeEmitter methods may be used to register and unregister PropertyChangeListeners. RenderedOps are also PropertyChangeListeners so that they may be registered as listeners of other PropertyChangeEmitters or the equivalent. Each RenderedOp also automatically receives any RenderingChangeEvents emitted by any of its sources which are also RenderedOps or any CollectionChangeEvents from any CollectionOp sources.

Certain PropertyChangeEvents may be emitted by the RenderedOp. These include the PropertyChangeEventJAIs and PropertySourceChangeEvents required by virtue of implementing the OperationNode interface. Additionally a RenderingChangeEvent may be emitted if the node has already been rendered and both of the following conditions are satisfied:

  1. A. any of the critical attributes is changed (edited), i.e., the operation name, operation registry, node sources, parameters, or rendering hints; or
    B. the node receives a RenderingChangeEvent from one of its RenderedOp sources or a CollectionChangeEvent from one of its CollectionOp sources.
  2. the old and new renderings differ over some non-empty region.

When a rendered RenderedOp node receives a RenderingChangeEvent from a RenderedOp source, then if the rendering is an OpImage, the region of the current rendering which may be retained will be determined by using mapSourceRect() to forward map the bounds of the invalid region. A similar procedure is used for "InvalidRegion" events emitted by source RenderedImages such as TiledImages. If a critical attribute of the node is edited, then the getInvalidRegion() method of the corresponding OperationDescriptor will be used to determine the invalid region. If the complement of the invalid region contains any tiles of the current rendering and the rendering is an OpImage, a new rendering of the node will be generated and the identified tiles will be retained from the old rendering insofar as possible. This might involve for example adding tiles to a TileCache under the ownership of the new rendering. A RenderingChangeEvent will then be fired to all PropertyChangeListeners of the node, and to any sinks that are PropertyChangeListeners. The newRendering parameter of the event constructor (which may be retrieved via the getNewValue() method of the event) will be set to either the new rendering of the node or to null if it was not possible to retain any tiles of the previous rendering.

RenderedOp nodes are WritablePropertySources and so manage a name-value database of image meta-data also known as image properties. Properties may be set on and requested from a node. The value of a property not explicitly set on the node (via setProperty()) is obtained from the property environment of the node. When a property is derived from the property environment it is cached locally to ensure synchronization, i.e., that properties do not change spontaneously if for example the same property is modified upstream.

The property environment of a RenderedOp is initially derived from that of the corresponding OperationDescriptor as maintained by the OperationRegistry. It may be modified locally by adding PropertyGenerators, directives to copy certain properties from specific sources, or requests to suppress certain properties. These modifications per se cannot be undone directly but may be eliminated as a side effect of other changes to the node as described below.

The RenderedOp itself synthesizes several property values, which may neither be set nor removed. These are: image_width, image_height, image_min_x_coord, image_min_y_coord, tile_cache and tile_cache_key. These properties are referred to as synthetic properties. The property tile_cache_key has a value of type TileCache which indicates where the tiles of the rendering are cached, if anywhere. The value of the property tile_cache_key is a RenderedImage by which the cached tiles are referenced in the indicated cache. If the rendering is of type OpImage or PlanarImageServerProxy then the value of tile_cache_key will be set to the rendering itself and the value of tile_cache to the value returned by invoking getTileCache() on the rendering. Otherwise these properties will be set to the same values as the properties of the same names set on the rendering. It is legal for these properties to have the value java.awt.Image.UndefinedProperty.

When a property value is requested an attempt will be made to derive it from the several entities in the following order of precedence:

  1. synthetic properties;
  2. local properties;
  3. the rendering of the node;
  4. any registered PropertyGenerators, or
    a source specified via a copy-from-source directive;
  5. the first node source which defines the property.
Local properties are those which have been cached locally either by virtue of direct invocation of setProperty() or due to caching of a property derived from the property environment. Note that the properties of a node are not copied to its rendering.

All dynamically computed properties of a RenderedOp which have been cached locally, i.e., those cached properties which were not set by an explicit call to setProperty(), will be cleared when any of the critical attributes of the node is edited. By implication these properties will also be cleared when a RenderingChangeEvent is received from any node source. The property environment or the cached properties may also be cleared by invoking resetProperties().

As mentioned, a RenderedOp chain created on a client may be passed to a server via a RemoteImage. Whether the node has been previously rendered is irrelevant to its ability to be serialized. Any RenderedImage sources which are not Serializable will be wrapped in SerializableRenderedImages for serialization. The tile transmission parameters will be determined from the RenderingHints of the node. All other non-serializable objects will attempt to be serialized using SerializerFactory. If no Serializer is available for a particular object, a java.io.NotSerializableException may result. Image properties (meta-data) are serialized insofar as they are serializable: non-serializable components are simply eliminated from the local cache of properties and from the property environment.

Note that RenderedOp nodes used to instantiate operations which have a corresponding OperationDescriptor the isImmediate() method of which returns true are rendered upon deserialization.

RenderedOp represents a single PlanarImage as a node in a RenderedImage operation chain. Its companion classes, RenderableOp and CollectionOp, represent nodes in operation chains of RenderableImages and CollectionImages, respectively.

See Also:
CollectionOp, JAI, OperationDescriptor, OperationRegistry, OpImage, RenderableOp, RenderingChangeEvent, SerializableRenderedImage, Serializer, SerializerFactory, RenderingHints, ParameterBlock, RenderedImageFactory, Serialized Form

Field Summary
protected  OperationNodeSupport nodeSupport
          An object to assist in implementing OperationNode.
protected  PlanarImage theImage
          The rendering of the current image, not preserved over RMI.
protected  PropertySource thePropertySource
          The PropertySource containing the combined properties of all of the node's sources.
 
Fields inherited from class javax.media.jai.PlanarImage
colorModel, eventManager, height, minX, minY, properties, sampleModel, tileFactory, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width
 
Constructor Summary
RenderedOp(OperationRegistry registry, String opName, ParameterBlock pb, RenderingHints hints)
          Constructs a RenderedOp that will be used to instantiate a particular rendered operation from the specified operation registry, an operation name, a ParameterBlock, and a set of rendering hints.
RenderedOp(String opName, ParameterBlock pb, RenderingHints hints)
          Constructs a RenderedOp that will be used to instantiate a particular rendered operation from the default operation registry, an operation name, a ParameterBlock, and a set of rendering hints.
 
Method Summary
 void addNodeSource(Object source)
          Deprecated. as of JAI 1.1 Use addSource(Object).
 void addPropertyGenerator(PropertyGenerator pg)
          Adds a PropertyGenerator to the node.
 boolean addSink(Object sink)
          Adds a sink to the list of node sinks.
 void addSink(PlanarImage sink)
          Adds a PlanarImage sink to the list of sinks of the node.
 void addSource(Object source)
          Adds a source to the ParameterBlock of this node.
 void addSource(PlanarImage source)
          Deprecated. as of JAI 1.1. Use addSource(Object).
 void cancelTiles(TileRequest request, Point[] tileIndices)
          Issue an advisory cancellation request to nullify processing of the indicated tiles.
 WritableRaster copyData()
          Renders the node if it has not already been rendered, and copies and returns the entire rendered image into a single raster.
 WritableRaster copyData(WritableRaster raster)
          Renders the node if it has not already been rendered, and copies a specified rectangle of the rendered image into the given WritableRaster.
 void copyPropertyFromSource(String propertyName, int sourceIndex)
          Forces a property to be copied from the specified source node.
 PlanarImage createInstance()
          Instantiate a PlanarImage that computes the result of this RenderedOp.
protected  PlanarImage createInstance(boolean isNodeRendered)
          This method performs the actions described by the documentation of createInstance() optionally marking the node as rendered according to the parameter.
protected  void createRendering()
          Creates a PlanarImage rendering if none exists and sets theImage to the resulting value.
 void dispose()
          Hints that this node and its rendering will no longer be used.
 byte getByteParameter(int index)
          Returns the specified parameter stored in the ParameterBlock of this node as a byte.
 char getCharParameter(int index)
          Returns the specified parameter stored in the ParameterBlock of this node as a char.
 ColorModel getColorModel()
          Renders the node if it has not already been rendered, and returns the ColorModel of the rendered image.
 PlanarImage getCurrentRendering()
          Returns the value of the protected variable theImage which may be null if no rendering has yet been created.
 Raster getData()
          Renders the node if it has not already been rendered, and returns the entire rendered image as a Raster.
 Raster getData(Rectangle rect)
          Renders the node if it has not already been rendered, and returns a specified rectangular region of the rendered image as a Raster.
 double getDoubleParameter(int index)
          Returns the specified parameter stored in the ParameterBlock of this node as a double.
 Object getDynamicProperty(String name)
          Returns the property associated with the specified property name, or java.awt.Image.UndefinedProperty if the specified property is not set on the image.
 float getFloatParameter(int index)
          Returns the specified parameter stored in the ParameterBlock of this node as a float.
 int getHeight()
          Renders the node if it has not already been rendered, and returns the height of the rendered image.
 int getIntParameter(int index)
          Returns the specified parameter stored in the ParameterBlock of this node as an int.
 long getLongParameter(int index)
          Returns the specified parameter stored in the ParameterBlock of this node as a long.
 int getMinX()
          Renders the node if it has not already been rendered, and returns the X coordinate of the leftmost column of the rendered image.
 int getMinY()
          Renders the node if it has not already been rendered, and returns the X coordinate of the uppermost row of the rendered image.
 PlanarImage getNewRendering()
          Forces the node to be re-rendered and returns the new rendering.
 Object getNodeSource(int index)
          Deprecated. as of JAI 1.1 Use getSourceObject(int).
 int getNumParameters()
          Returns the number of parameters stored in the ParameterBlock of this node.
 int getNumSources()
          Returns the number of sources stored in the ParameterBlock of this node.
 Object getObjectParameter(int index)
          Returns the specified parameter stored in the ParameterBlock of this node as an Object.
 String getOperationName()
          Returns the name of the operation this node represents as a String.
 ParameterBlock getParameterBlock()
          Returns a clone of the ParameterBlock of this node.
 Vector getParameters()
          Returns a clone of the Vector of parameters stored in the ParameterBlock of this node.
 Object getProperty(String name)
          Returns the property associated with the specified property name, or java.awt.Image.UndefinedProperty if the specified property is not set on the image.
 Class getPropertyClass(String name)
          Returns the class expected to be returned by a request for the property with the specified name.
 String[] getPropertyNames()
          Returns the names of properties available from this node.
 OperationRegistry getRegistry()
          Returns the OperationRegistry that is used by this node.
 String getRegistryModeName()
          Returns the name of the RegistryMode corresponding to this RenderedOp.
 PlanarImage getRendering()
          Returns the PlanarImage rendering associated with this RenderedOp node.
 Object getRenderingHint(RenderingHints.Key key)
          Gets a hint from the RenderingHints of this node.
 RenderingHints getRenderingHints()
          Returns a clone of the RenderingHints of this node or null.
 SampleModel getSampleModel()
          Renders the node if it has not already been rendered, and returns the SampleModel of the rendered image.
 short getShortParameter(int index)
          Returns the specified parameter stored in the ParameterBlock of this node as a short.
 PlanarImage getSource(int index)
          Deprecated. as of JAI 1.1. Use getSourceObject().
 PlanarImage getSourceImage(int index)
          Returns the specified PlanarImage source stored in the ParameterBlock of this node.
 Object getSourceObject(int index)
          Returns the specified source stored in the ParameterBlock of this node.
 Vector getSources()
          Returns a clone of the Vector of sources stored in the ParameterBlock of this node.
 Raster getTile(int tileX, int tileY)
          Renders the node if it has not already been rendered, and returns the specified tile of the rendered image.
 int getTileGridXOffset()
          Renders the node if it has not already been rendered, and returns the tile grid X offset of the rendered image.
 int getTileGridYOffset()
          Renders the node if it has not already been rendered, and returns the tile grid Y offset of the rendered image.
 int getTileHeight()
          Renders the node if it has not already been rendered, and returns the tile height of the rendered image.
 Raster[] getTiles(Point[] tileIndices)
          Renders the node if it has not already been rendered, and returns the tiles indicated by the tileIndices of the rendered image as an array of Rasters.
 int getTileWidth()
          Renders the node if it has not already been rendered, and returns the tile width of the rendered image.
 int getWidth()
          Renders the node if it has not already been rendered, and returns the width of the rendered image.
 Point2D mapDestPoint(Point2D destPt, int sourceIndex)
          Computes the position in the specified source that best matches the supplied destination image position.
 Point2D mapSourcePoint(Point2D sourcePt, int sourceIndex)
          Computes the position in the destination that best matches the supplied source image position.
 void prefetchTiles(Point[] tileIndices)
          Renders the node if it has not already been rendered.
 void propertyChange(PropertyChangeEvent evt)
          Implementation of PropertyChangeListener.
 TileRequest queueTiles(Point[] tileIndices)
          Queues a list of tiles for computation.
 void removeProperty(String name)
          Removes the named property from the local property set of the RenderedOp as well as from its property environment.
 boolean removeSink(Object sink)
          Removes a sink from the list of node sinks.
 boolean removeSink(PlanarImage sink)
          Removes a PlanarImage sink from the list of sinks of the node.
 void removeSinks()
          Removes all sinks from the list of sinks of the node.
 boolean removeSource(Object source)
          Removes the specified Object source from the ParameterBlock of this node.
 boolean removeSource(PlanarImage source)
          Deprecated. as of JAI 1.1. Use removeSource(Object).
 void removeSources()
          Removes all the sources stored in the ParameterBlock of this node.
protected  void resetProperties(boolean resetPropertySource)
          Resets the PropertySource.
 void setNodeSource(Object source, int index)
          Deprecated. as of JAI 1.1 Use setSource(Object,int).
 void setOperationName(String opName)
          Sets the name of the operation this node represents.
 void setParameter(byte param, int index)
          Sets one of the node's parameters to a byte.
 void setParameter(char param, int index)
          Sets one of the node's parameters to a char.
 void setParameter(double param, int index)
          Sets one of the node's parameters to a double.
 void setParameter(float param, int index)
          Sets one of the node's parameters to a float.
 void setParameter(int param, int index)
          Sets one of the node's parameters to an int.
 void setParameter(long param, int index)
          Sets one of the node's parameters to a long.
 void setParameter(Object param, int index)
          Sets one of the node's parameters to an Object.
 void setParameter(short param, int index)
          Sets one of the node's parameters to a short.
 void setParameterBlock(ParameterBlock pb)
          Sets the ParameterBlock of this node.
 void setParameters(Vector parameters)
          Sets all the parameters of this node.
 void setProperty(String name, Object value)
          Sets a local property on a node.
 void setRegistry(OperationRegistry registry)
          Sets the OperationRegistry that is used by this node.
 void setRenderingHint(RenderingHints.Key key, Object value)
          Sets a hint in the RenderingHints of this node.
 void setRenderingHints(RenderingHints hints)
          Sets the RenderingHints of this node.
 void setSource(Object source, int index)
          Sets the specified source stored in the ParameterBlock of this node to a new source object.
 void setSource(PlanarImage source, int index)
          Deprecated. as of JAI 1.1. Use setSource(Object, int).
 void setSources(List sourceList)
          Replaces the sources in the ParameterBlock of this node with a new list of sources.
 void suppressProperty(String name)
          Removes a named property from the property environment of this node.
 
Methods inherited from class javax.media.jai.PlanarImage
addPropertyChangeListener, addPropertyChangeListener, addTileComputationListener, copyExtendedData, createColorModel, createSnapshot, createWritableRaster, finalize, getAsBufferedImage, getAsBufferedImage, getBounds, getDefaultColorModel, getExtendedData, getGraphics, getImageID, getMaxTileX, getMaxTileY, getMaxX, getMaxY, getMinTileX, getMinTileY, getNumBands, getNumXTiles, getNumYTiles, getProperties, getPropertyNames, getSinks, getSplits, getTileComputationListeners, getTileFactory, getTileIndices, getTileRect, getTiles, overlapsMultipleTiles, removePropertyChangeListener, removePropertyChangeListener, removeTileComputationListener, setImageLayout, setProperties, 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
 
Methods inherited from interface javax.media.jai.PropertySource
getPropertyNames
 
Methods inherited from interface javax.media.jai.PropertyChangeEmitter
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

nodeSupport

protected OperationNodeSupport nodeSupport
An object to assist in implementing OperationNode.
Since:
JAI 1.1

thePropertySource

protected transient PropertySource thePropertySource
The PropertySource containing the combined properties of all of the node's sources.

theImage

protected transient PlanarImage theImage
The rendering of the current image, not preserved over RMI.
Constructor Detail

RenderedOp

public RenderedOp(OperationRegistry registry,
                  String opName,
                  ParameterBlock pb,
                  RenderingHints hints)
Constructs a RenderedOp that will be used to instantiate a particular rendered operation from the specified operation registry, an operation name, a ParameterBlock, and a set of rendering hints.

This method does not validate the contents of the supplied ParameterBlock. The caller should ensure that the sources and parameters in the ParameterBlock are suitable for the operation this node represents; otherwise some form of error or exception may occur at the time of rendering.

The ParameterBlock may include DeferredData parameters. These will not be evaluated until their values are actually required, i.e., when the node is rendered.

The node is added automatically as a sink of any PlanarImage or CollectionImage sources.

Parameters:
registry - The OperationRegistry to be used for instantiation. if null, the default registry is used. Saved by reference.
opName - The operation name. Saved by reference.
pb - The sources and parameters. If null, it is assumed that this node has no sources and parameters. This parameter is cloned.
hints - The rendering hints. If null, it is assumed that no hints are associated with the rendering. This parameter is cloned.
Throws:
IllegalArgumentException - if opName is null.

RenderedOp

public RenderedOp(String opName,
                  ParameterBlock pb,
                  RenderingHints hints)
Constructs a RenderedOp that will be used to instantiate a particular rendered operation from the default operation registry, an operation name, a ParameterBlock, and a set of rendering hints. The default operation registry is used.

This method does not validate the contents of the supplied ParameterBlock. The caller should ensure that the sources and parameters in the ParameterBlock are suitable for the operation this node represents; otherwise some form of error or exception may occur at the time of rendering.

The ParameterBlock may include DeferredData parameters. These will not be evaluated until their values are actually required, i.e., when the node is rendered.

The node is added automatically as a sink of any PlanarImage or CollectionImage sources.

Parameters:
opName - The operation name. Saved by reference.
pb - The sources and parameters. If null, it is assumed that this node has no sources and parameters. This parameter is cloned.
hints - The rendering hints. If null, it is assumed that no hints are associated with the rendering. This parameter is cloned.
Throws:
IllegalArgumentException - if opName is null.
Method Detail

getRegistryModeName

public String getRegistryModeName()
Returns the name of the RegistryMode corresponding to this RenderedOp. This method always returns the String "rendered".
Specified by:
getRegistryModeName in interface OperationNode
Since:
JAI 1.1

getRegistry

public OperationRegistry getRegistry()
Returns the OperationRegistry that is used by this node. If the registry is not set, the default registry is returned.
Specified by:
getRegistry in interface OperationNode

setRegistry

public void setRegistry(OperationRegistry registry)
Sets the OperationRegistry that is used by this node. If the specified registry is null, the default registry is used. The parameter is saved by reference.

If the supplied registry does not equal the current registry, a PropertyChangeEventJAI named "OperationRegistry" will be fired and a RenderingChangeEvent may be fired if the node has already been rendered.

Specified by:
setRegistry in interface OperationNode
Parameters:
registry - The new OperationRegistry to be set; it may be null.

getOperationName

public String getOperationName()
Returns the name of the operation this node represents as a String.
Specified by:
getOperationName in interface OperationNode

setOperationName

public void setOperationName(String opName)
Sets the name of the operation this node represents. The parameter is saved by reference.

If the supplied name does not equal the current operation name, a PropertyChangeEventJAI named "OperationName" will be fired and a RenderingChangeEvent may be fired if the node has already been rendered.

Specified by:
setOperationName in interface OperationNode
Parameters:
opName - The new operation name to be set.
Throws:
IllegalArgumentException - if opName is null.

getParameterBlock

public ParameterBlock getParameterBlock()
Returns a clone of the ParameterBlock of this node.
Specified by:
getParameterBlock in interface OperationNode

setParameterBlock

public void setParameterBlock(ParameterBlock pb)
Sets the ParameterBlock of this node. If the specified new ParameterBlock is null, it is assumed that this node has no input sources and parameters. The supplied parameter is cloned.

This method does not validate the content of the supplied ParameterBlock. The caller should ensure that the sources and parameters in the ParameterBlock are suitable for the operation this node represents; otherwise some form of error or exception may occur at the time of rendering.

If the supplied ParameterBlock does not equal the current ParameterBlock, a PropertyChangeEventJAI named "ParameterBlock", "Sources", or "Parameters" will be fired. A RenderingChangeEvent may also be fired if the node has already been rendered.

The ParameterBlock may include DeferredData parameters. These will not be evaluated until their values are actually required, i.e., when the node is rendered.

The node is registered as a sink of any PlanarImage or CollectionImage sources contained in the supplied ParameterBlock. The node is also removed as a sink of any previous PlanarImage or CollectionImage sources if these are not in the new ParameterBlock.

Specified by:
setParameterBlock in interface OperationNode
Parameters:
pb - The new ParameterBlock to be set; it may be null.

getRenderingHints

public RenderingHints getRenderingHints()
Returns a clone of the RenderingHints of this node or null.
Specified by:
getRenderingHints in interface OperationNode

setRenderingHints

public void setRenderingHints(RenderingHints hints)
Sets the RenderingHints of this node. The supplied parameter is cloned if non-null.

If the supplied RenderingHints does not equal the current RenderingHints, a PropertyChangeEventJAI named "RenderingHints" will be fired and a RenderingChangeEvent may be fired if the node has already been rendered.

Specified by:
setRenderingHints in interface OperationNode
Parameters:
hints - The new RenderingHints to be set; it may be null.

createInstance

public PlanarImage createInstance()
Instantiate a PlanarImage that computes the result of this RenderedOp. The local OperationRegistry of this node is used to translate the operation name into a RenderedImageFactory and eventually an actual RenderedImage (usually an OpImage).

During this method, all the sources supplied in the ParameterBlock are checked. If any of the sources is a RenderedOp, a rendering of that source is created. This propagates all the way up to the top of the op chain. If any of the sources is a Collection, then the collection is passed to the operation as-is. If there is a RenderedOp anywhere in the collection, it is up to the individual operation to create the rendering for that RenderedOp.

This method does not validate the sources and parameters stored in the ParameterBlock against the specification of the operation this node represents. It is the responsibility of the caller to ensure that the data in the ParameterBlock are suitable for this operation. Otherwise, some kind of exception or error will occur.

Invoking this method will cause any source RenderedOp nodes to be rendered using getRendering() and any source CollectionOp nodes to be rendered using getCollection(). Any DeferredData parameters in the ParameterBlock will also be evaluated.

The RenderedImage generated by the selected RenderedImageFactory will be converted to a PlanarImage by invoking PlanarImage.wrapRenderedImage().

Returns:
The resulting image as a PlanarImage.
Throws:
RuntimeException - if the image factory charged with rendering the node is unable to create a rendering.

createInstance

protected PlanarImage createInstance(boolean isNodeRendered)
This method performs the actions described by the documentation of createInstance() optionally marking the node as rendered according to the parameter.
Throws:
RuntimeException - if the image factory charged with rendering the node is unable to create a rendering.
Since:
JAI 1.1
See Also:
createInstance()

createRendering

protected void createRendering()
Creates a PlanarImage rendering if none exists and sets theImage to the resulting value. This method performs the same actions as createInstance() but sets theImage to the result.
Throws:
RuntimeException - if the image factory charged with rendering the node is unable to create a rendering.
Since:
JAI 1.1
See Also:
createInstance()

getRendering

public PlanarImage getRendering()
Returns the PlanarImage rendering associated with this RenderedOp node. This method performs the same action as createRendering() but returns theImage.
Throws:
RuntimeException - if the image factory charged with rendering the node is unable to create a rendering.
See Also:
createRendering(), createInstance()

getCurrentRendering

public PlanarImage getCurrentRendering()
Returns the value of the protected variable theImage which may be null if no rendering has yet been created. This method does not force the node to be rendered.
Since:
JAI 1.1

getNewRendering

public PlanarImage getNewRendering()
Forces the node to be re-rendered and returns the new rendering.

If the node has not yet been rendered this method is identical to getRendering().

If the node has already been rendered, then a new rendering will be generated. The synthetic and locally cached properties and the property environment of the node will all be reset. All registered PropertyChangeListeners and any PropertyChangeListener sinks will be notifed of the change in the rendering via a RenderingChangeEvent the invalid region of which will be null.

This method could be used for example to trigger a re-rendering of the node in cases where this would not happen automatically but is desirable to the application. One example occurs if a parameter of the operation is a referent of some other entity which changes but the parameter itself does not change according to equals(). This could occur for example for an image file input operation wherein the path to the file remains the same but the content of the file changes.

Returns:
The (possibly regenerated) rendering of the node. This value may be ignored if the intent of invoking the method was merely to re-render the node and generate events for RenderingChangeEvent listeners.
Since:
JAI 1.1

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Implementation of PropertyChangeListener.

When invoked with an event which is an instance of RenderingChangeEvent or CollectionChangeEvent emitted by a RenderedOp or CollectionOp, respectively, the node will respond by re-rendering itself while retaining any tiles possible. It will respond to an "InvalidRegion" event emitted by a source RenderedImage in a manner similar to that applied for RenderingChangeEvents.

Specified by:
propertyChange in interface PropertyChangeListener
Since:
JAI 1.1
See Also:
TiledImage.propertyChange(java.beans.PropertyChangeEvent)

addNodeSource

public void addNodeSource(Object source)
Deprecated. as of JAI 1.1 Use addSource(Object).

Adds a source to the ParameterBlock of this node. This is a convenience method that invokes setParameterBlock() and so adheres to the same event firing behavior.
Parameters:
source - The source to be added to the ParameterBlock

setNodeSource

public void setNodeSource(Object source,
                          int index)
Deprecated. as of JAI 1.1 Use setSource(Object,int).

Sets the specified source stored in the ParameterBlock of this node to a new source object. This is a convenience method that invokes setParameterBlock() and so adheres to the same event firing behavior.
Parameters:
source - The Source to be set.
index - The Index at which it is to be set.
Throws:
IllegalArgumentException - if source is null.
ArrayIndexOutOfBoundsException - if index is invalid.

getNodeSource

public Object getNodeSource(int index)
Deprecated. as of JAI 1.1 Use getSourceObject(int).

Returns the specified source stored in the ParameterBlock of this node. If there is no source corresponding to the specified index, an ArrayIndexOutOfBoundsException will be thrown.
Parameters:
index - The index of the source.

getNumParameters

public int getNumParameters()
Returns the number of parameters stored in the ParameterBlock of this node.

getParameters

public Vector getParameters()
Returns a clone of the Vector of parameters stored in the ParameterBlock of this node.

getByteParameter

public byte getByteParameter(int index)
Returns the specified parameter stored in the ParameterBlock of this node as a byte. An ArrayIndexOutOfBoundsException may occur if an invalid index is supplied
Parameters:
index - The index of the parameter.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.

getCharParameter

public char getCharParameter(int index)
Returns the specified parameter stored in the ParameterBlock of this node as a char. An ArrayIndexOutOfBoundsException may occur if an invalid index is supplied
Parameters:
index - The index of the parameter.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.

getShortParameter

public short getShortParameter(int index)
Returns the specified parameter stored in the ParameterBlock of this node as a short. An ArrayIndexOutOfBoundsException may occur if an invalid index is supplied
Parameters:
index - The index of the parameter.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.

getIntParameter

public int getIntParameter(int index)
Returns the specified parameter stored in the ParameterBlock of this node as an int. An ArrayIndexOutOfBoundsException may occur if an invalid index is supplied
Parameters:
index - The index of the parameter.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.

getLongParameter

public long getLongParameter(int index)
Returns the specified parameter stored in the ParameterBlock of this node as a long. An ArrayIndexOutOfBoundsException may occur if an invalid index is supplied
Parameters:
index - The index of the parameter.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.

getFloatParameter

public float getFloatParameter(int index)
Returns the specified parameter stored in the ParameterBlock of this node as a float. An ArrayIndexOutOfBoundsException may occur if an invalid index is supplied
Parameters:
index - The index of the parameter.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.

getDoubleParameter

public double getDoubleParameter(int index)
Returns the specified parameter stored in the ParameterBlock of this node as a double. An ArrayIndexOutOfBoundsException may occur if an invalid index is supplied
Parameters:
index - The index of the parameter.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.

getObjectParameter

public Object getObjectParameter(int index)
Returns the specified parameter stored in the ParameterBlock of this node as an Object. An ArrayIndexOutOfBoundsException may occur if an invalid index is supplied
Parameters:
index - The index of the parameter.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.

setParameters

public void setParameters(Vector parameters)
Sets all the parameters of this node. This is a convenience method that invokes setParameterBlock() and so adheres to the same event firing behavior.

The Vector may include DeferredData parameters. These will not be evaluated until their values are actually required, i.e., when the node is rendered.

Since:
JAI 1.1

setParameter

public void setParameter(byte param,
                         int index)
Sets one of the node's parameters to a byte. If the index lies beyond the current source list, the list is extended with nulls as needed. This is a convenience method that invokes setParameter(Object,int) and so adheres to the same event firing behavior.
Parameters:
param - The parameter, as a byte.
index - The index of the parameter.

setParameter

public void setParameter(char param,
                         int index)
Sets one of the node's parameters to a char. If the index lies beyond the current source list, the list is extended with nulls as needed. This is a convenience method that invokes setParameter(Object,int) and so adheres to the same event firing behavior.
Parameters:
param - The parameter, as a char.
index - The index of the parameter.

setParameter

public void setParameter(short param,
                         int index)
Sets one of the node's parameters to a short. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
param - The parameter, as a short.
index - The index of the parameter.

setParameter

public void setParameter(int param,
                         int index)
Sets one of the node's parameters to an int. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
param - The parameter, as an int.
index - The index of the parameter.

setParameter

public void setParameter(long param,
                         int index)
Sets one of the node's parameters to a long. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
param - The parameter, as a long.
index - The index of the parameter.

setParameter

public void setParameter(float param,
                         int index)
Sets one of the node's parameters to a float. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
param - The parameter, as a float.
index - The index of the parameter.

setParameter

public void setParameter(double param,
                         int index)
Sets one of the node's parameters to a double. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
param - The parameter, as a double.
index - The index of the parameter.

setParameter

public void setParameter(Object param,
                         int index)
Sets one of the node's parameters to an Object. If the index lies beyond the current source list, the list is extended with nulls as needed. This is a convenience method that invokes setParameterBlock() and so adheres to the same event firing behavior.

The Object may be a DeferredData instance. It will not be evaluated until its value is actually required, i.e., when the node is rendered.

Parameters:
param - The parameter, as an Object.
index - The index of the parameter.

setRenderingHint

public void setRenderingHint(RenderingHints.Key key,
                             Object value)
Sets a hint in the RenderingHints of this node. This is a convenience method which calls setRenderingHints() and so adheres to the same event firing behavior.
Throws:
IllegalArgumentException - if the key or value is null.
IllegalArgumentException - value is not appropriate for the specified key.
Since:
JAI 1.1

getRenderingHint

public Object getRenderingHint(RenderingHints.Key key)
Gets a hint from the RenderingHints of this node.
Returns:
the value associated with the specified key or null if the key is not mapped to any value.
Since:
JAI 1.1

resetProperties

protected void resetProperties(boolean resetPropertySource)
Resets the PropertySource. If the parameter is true then the property environment is completely reset; if false then only cached properties are cleared, i.e., those which were derived from the property environment and are now stored in the local cache.
Since:
JAI 1.1

getPropertyNames

public String[] getPropertyNames()
Returns the names of properties available from this node. These properties are a combination of those derived from prior nodes in the imaging chain, those set locally, and a number of locally derived, immutable properties based on the rendering associated with this node -- height, width, and so forth.
Specified by:
getPropertyNames in interface PropertySource
Overrides:
getPropertyNames in class PlanarImage
Returns:
An array of Strings containing valid property names.

getPropertyClass

public Class getPropertyClass(String name)
Returns the class expected to be returned by a request for the property with the specified name. If this information is unavailable, null will be returned.
Specified by:
getPropertyClass in interface PropertySource
Overrides:
getPropertyClass in class PlanarImage
Returns:
The Class expected to be return by a request for the value of this property or null.
Throws:
IllegalArgumentException - if name is null.
Since:
JAI 1.1

getProperty

public Object getProperty(String name)
Returns the property associated with the specified property name, or java.awt.Image.UndefinedProperty if the specified property is not set on the image. If name equals the name of any synthetic property, i.e., image_width, image_height, image_min_x_coord, or image_min_y_coord, then the node will be rendered.
Specified by:
getProperty in interface PropertySource
Overrides:
getProperty in class PlanarImage
Parameters:
name - A String naming the property.
Throws:
IllegalArgumentException - if name is null.

setProperty

public void setProperty(String name,
                        Object value)
Sets a local property on a node. The synthetic properties (containing image width, height, and location) may not be set. Local property settings override properties derived from prior nodes in the imaging chain.

If the node is serialized then serializable properties will also be serialized but non-serializable properties will be lost.

Overrides:
setProperty in class PlanarImage
Parameters:
name - A String representing the property name.
value - The property's value, as an Object.
Throws:
IllegalArgumentException - if name is null.
IllegalArgumentException - if value is null.
RuntimeException - if name conflicts with Synthetic property.

removeProperty

public void removeProperty(String name)
Removes the named property from the local property set of the RenderedOp as well as from its property environment. The synthetic properties (containing image width, height, and position) may not be removed.
Overrides:
removeProperty in class PlanarImage
Throws:
IllegalArgumentException - if name is null.
RuntimeException - if name conflicts with Synthetic property.
Since:
JAI 1.1

getDynamicProperty

public Object getDynamicProperty(String name)
Returns the property associated with the specified property name, or java.awt.Image.UndefinedProperty if the specified property is not set on the image. This method is dynamic in the sense that subsequent invocations of this method on the same object may return different values as a function of changes in the property environment of the node, e.g., a change in which PropertyGenerators are registered or in the values associated with properties of node sources. The case of the property name passed to this method is ignored.
Specified by:
getDynamicProperty in interface OperationNode
Parameters:
name - A String naming the property.
Throws:
IllegalArgumentException - if name is null.
Since:
JAI 1.1

addPropertyGenerator

public void addPropertyGenerator(PropertyGenerator pg)
Adds a PropertyGenerator to the node. The property values emitted by this property generator override any previous definitions.
Specified by:
addPropertyGenerator in interface OperationNode
Parameters:
pg - A PropertyGenerator to be added to this node's property environment.
Throws:
IllegalArgumentException - if pg is null.

copyPropertyFromSource

public void copyPropertyFromSource(String propertyName,
                                   int sourceIndex)
Forces a property to be copied from the specified source node. By default, a property is copied from the first source node that emits it. The result of specifying an invalid source is undefined.
Specified by:
copyPropertyFromSource in interface OperationNode
Parameters:
propertyName - the name of the property to be copied.
sourceIndex - the index of the from which to copy the property.
Throws:
IllegalArgumentException - if propertyName is null.
Since:
JAI 1.1

suppressProperty

public void suppressProperty(String name)
Removes a named property from the property environment of this node. Unless the property is stored locally either due to having been set explicitly via setProperty() or to having been cached for property synchronization purposes, subsequent calls to getProperty(name) will return java.awt.Image.UndefinedProperty, and name will not appear on the list of properties emitted by getPropertyNames(). To delete the property from the local property set of the node, removeProperty() should be used.
Specified by:
suppressProperty in interface OperationNode
Parameters:
name - A String naming the property to be suppressed.
Throws:
IllegalArgumentException - if name is null.
IllegalArgumentException - if name conflicts with Synthetic property.

getMinX

public int getMinX()
Renders the node if it has not already been rendered, and returns the X coordinate of the leftmost column of the rendered image.
Overrides:
getMinX in class PlanarImage

getMinY

public int getMinY()
Renders the node if it has not already been rendered, and returns the X coordinate of the uppermost row of the rendered image.
Overrides:
getMinY in class PlanarImage

getWidth

public int getWidth()
Renders the node if it has not already been rendered, and returns the width of the rendered image.
Overrides:
getWidth in class PlanarImage

getHeight

public int getHeight()
Renders the node if it has not already been rendered, and returns the height of the rendered image.
Overrides:
getHeight in class PlanarImage

getTileWidth

public int getTileWidth()
Renders the node if it has not already been rendered, and returns the tile width of the rendered image.
Overrides:
getTileWidth in class PlanarImage

getTileHeight

public int getTileHeight()
Renders the node if it has not already been rendered, and returns the tile height of the rendered image.
Overrides:
getTileHeight in class PlanarImage

getTileGridXOffset

public int getTileGridXOffset()
Renders the node if it has not already been rendered, and returns the tile grid X offset of the rendered image.
Overrides:
getTileGridXOffset in class PlanarImage

getTileGridYOffset

public int getTileGridYOffset()
Renders the node if it has not already been rendered, and returns the tile grid Y offset of the rendered image.
Overrides:
getTileGridYOffset in class PlanarImage

getSampleModel

public SampleModel getSampleModel()
Renders the node if it has not already been rendered, and returns the SampleModel of the rendered image.
Overrides:
getSampleModel in class PlanarImage

getColorModel

public ColorModel getColorModel()
Renders the node if it has not already been rendered, and returns the ColorModel of the rendered image.
Overrides:
getColorModel in class PlanarImage

getTile

public Raster getTile(int tileX,
                      int tileY)
Renders the node if it has not already been rendered, and returns the specified tile of the rendered image.
Overrides:
getTile in class PlanarImage
Parameters:
tileX - The X index of the tile.
tileY - The Y index of the tile.
Returns:
The requested tile as a Raster.

getData

public Raster getData()
Renders the node if it has not already been rendered, and returns the entire rendered image as a Raster.
Overrides:
getData in class PlanarImage
Following copied from class: javax.media.jai.PlanarImage
Returns:
A Raster containing the entire image data.
Throws:
IllegalArgumentException - If the size of the returned data is too large to be stored in a single Raster.

getData

public Raster getData(Rectangle rect)
Renders the node if it has not already been rendered, and returns a specified rectangular region of the rendered image as a Raster.
Overrides:
getData in class PlanarImage
Following copied from class: javax.media.jai.PlanarImage
Parameters:
region - The rectangular region of this image to be returned, or null.
Returns:
A Raster containing the specified image data.
Throws:
IllegalArgumentException - If the region does not intersect the image bounds.
IllegalArgumentException - If the size of the returned data is too large to be stored in a single Raster.

copyData

public WritableRaster copyData()
Renders the node if it has not already been rendered, and copies and returns the entire rendered image into a single raster.
Overrides:
copyData in class PlanarImage

copyData

public WritableRaster copyData(WritableRaster raster)
Renders the node if it has not already been rendered, and copies a specified rectangle of the rendered image into the given WritableRaster.
Overrides:
copyData in class PlanarImage
Parameters:
raster - A WritableRaster to be filled with image data.
Returns:
A reference to the supplied WritableRaster.

getTiles

public Raster[] getTiles(Point[] tileIndices)
Renders the node if it has not already been rendered, and returns the tiles indicated by the tileIndices of the rendered image as an array of Rasters.
Overrides:
getTiles in class PlanarImage
Parameters:
tileIndices - An array of Points representing TileIndices.
Returns:
An array of Raster containing the tiles corresponding to the given TileIndices.
Throws:
IllegalArgumentException - If tileIndices is null.

queueTiles

public TileRequest queueTiles(Point[] tileIndices)
Queues a list of tiles for computation. Registered listeners will be notified after each tile has been computed. The event source parameter passed to such listeners will be the node itself; the image parameter will be the rendering of the node. The RenderedOp itself in fact should monitor any TileComputationListener events of its rendering and forward any such events to any of its registered listeners.
Overrides:
queueTiles in class PlanarImage
Parameters:
tileIndices - A list of tile indices indicating which tiles to schedule for computation.
Throws:
IllegalArgumentException - If tileIndices is null.
Since:
JAI 1.1

cancelTiles

public void cancelTiles(TileRequest request,
                        Point[] tileIndices)
Issue an advisory cancellation request to nullify processing of the indicated tiles.
Overrides:
cancelTiles in class PlanarImage
Parameters:
request - The request for which tiles are to be cancelled.
tileIndices - The tiles to be cancelled; may be null. Any tiles not actually in the TileRequest will be ignored.
Throws:
IllegalArgumentException - If request is null.
Since:
JAI 1.1

prefetchTiles

public void prefetchTiles(Point[] tileIndices)
Renders the node if it has not already been rendered. Hints that the given tiles of the rendered image might be needed in the near future.
Overrides:
prefetchTiles in class PlanarImage
Parameters:
tileIndices - A list of tileIndices indicating which tiles to prefetch.
Throws:
IllegalArgumentException - If tileIndices is null.

addSource

public void addSource(PlanarImage source)
Deprecated. as of JAI 1.1. Use addSource(Object).

Adds a PlanarImage source to the ParameterBlock of this node. This is a convenience method that invokes setParameterBlock() and so adheres to the same event firing behavior.

Note that the behavior of this method has changed as of Java Advanced Imaging 1.1. To obtain the previous behavior use getRendering().addSource(). The description of the previous behavior is as follows:

Renders the node if it has not already been rendered, and adds a PlanarImage source to the list of sources of the rendered image.
Parameters:
source - The source to be added to the ParameterBlock
Throws:
IllegalArgumentException - if source is null.

setSource

public void setSource(PlanarImage source,
                      int index)
Deprecated. as of JAI 1.1. Use setSource(Object, int).

Sets the specified source stored in the ParameterBlock of this node to a new PlanarImage source. This is a convenience method that invokes setParameterBlock() and so adheres to the same event firing behavior.

Note that the behavior of this method has changed as of Java Advanced Imaging 1.1. To obtain the previous behavior use getRendering().setSource(). The description of the previous behavior is as follows:

Renders the node if it has not already been rendered, and sets the specified source of the rendered image to the supplied PlanarImage. An ArrayIndexOutOfBoundsException may be thrown if an invalid index is supplied.
Parameters:
source - The source, as a PlanarImage.
index - The index of the source.
Throws:
IllegalArgumentException - if source is null.
ArrayIndexOutOfBoundsException - if index is invalid.

getSource

public PlanarImage getSource(int index)
Deprecated. as of JAI 1.1. Use getSourceObject().

Returns the specified PlanarImage source stored in the ParameterBlock of this node. If there is no source corresponding to the specified index, an ArrayIndexOutOfBoundsException will be thrown.

Note that the behavior of this method has changed as of Java Advanced Imaging 1.1. To obtain the previous behavior use getRendering().getSource(). The description of the previous behavior is as follows:

Renders the node if it has not already been rendered, and returns the specified PlanarImage source of the rendered image. If there is no source corresponding to the specified index, this method will throw an ArrayIndexOutOfBoundsException. The source returned may differ from the source stored in the ParameterBlock of this node.
Overrides:
getSource in class PlanarImage
Parameters:
index - The index of the desired source.
Returns:
A PlanarImage source.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.
ClassCastException - if the source at the indicated index is not a PlanarImage.

removeSource

public boolean removeSource(PlanarImage source)
Deprecated. as of JAI 1.1. Use removeSource(Object).

Removes the specified PlanarImage source from the ParameterBlock of this node.

Note that the behavior of this method has changed as of Java Advanced Imaging 1.1. To obtain the previous behavior use getRendering().removeSource(). The description of the previous behavior is as follows:

Renders the node if it has not already been rendered, and removes a PlanarImage source from the list of sources of the rendered image.
Parameters:
source - A PlanarImage to be removed.
Returns:
true if the element was present, false otherwise.
Throws:
IllegalArgumentException - if source is null.

addSource

public void addSource(Object source)
Adds a source to the ParameterBlock of this node. This is a convenience method that invokes setParameterBlock() and so adheres to the same event firing behavior.

The node is added automatically as a sink if the source is a PlanarImage or a CollectionImage.

Overrides:
addSource in class PlanarImage
Parameters:
source - The source to be added to the ParameterBlock
Throws:
IllegalArgumentException - if source is null.
Since:
JAI 1.1

setSource

public void setSource(Object source,
                      int index)
Sets the specified source stored in the ParameterBlock of this node to a new source object. This is a convenience method that invokes setParameterBlock() and so adheres to the same event firing behavior.

The node is added automatically as a sink if the source is a PlanarImage or a CollectionImage. If appropriate the node is removed as a sink of any previous source at the same index.

Overrides:
setSource in class PlanarImage
Parameters:
source - The Source to be set.
index - The Index at which it is to be set.
Throws:
IllegalArgumentException - if source is null.
ArrayIndexOutOfBoundsException - if index is invalid.
Since:
JAI 1.1

removeSource

public boolean removeSource(Object source)
Removes the specified Object source from the ParameterBlock of this node.

The node is removed automatically as a sink if the source is a PlanarImage or a CollectionImage.

Overrides:
removeSource in class PlanarImage
Parameters:
source - A Object to be removed.
Returns:
true if the element was present, false otherwise.
Throws:
IllegalArgumentException - if source is null.
Since:
JAI 1.1

getSourceImage

public PlanarImage getSourceImage(int index)
Returns the specified PlanarImage source stored in the ParameterBlock of this node. If there is no source corresponding to the specified index, an ArrayIndexOutOfBoundsException will be thrown.
Overrides:
getSourceImage in class PlanarImage
Parameters:
index - The index of the desired source.
Returns:
A PlanarImage source.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.
ClassCastException - if the source at the indicated index is not a PlanarImage.
Since:
JAI 1.1

getSourceObject

public Object getSourceObject(int index)
Returns the specified source stored in the ParameterBlock of this node. If there is no source corresponding to the specified index, an ArrayIndexOutOfBoundsException will be thrown.
Overrides:
getSourceObject in class PlanarImage
Parameters:
index - The index of the source.
Throws:
ArrayIndexOutOfBoundsException - if index is invalid.
Since:
JAI 1.1

getNumSources

public int getNumSources()
Returns the number of sources stored in the ParameterBlock of this node. This may differ from the number of sources of the rendered image.
Overrides:
getNumSources in class PlanarImage

getSources

public Vector getSources()
Returns a clone of the Vector of sources stored in the ParameterBlock of this node. This may differ from the source vector of the rendering of the node.
Overrides:
getSources in class PlanarImage

setSources

public void setSources(List sourceList)
Replaces the sources in the ParameterBlock of this node with a new list of sources. This is a convenience method that invokes setParameterBlock() and so adheres to the same event firing behavior.

The node is added automatically as a sink of any source which is a PlanarImage or a CollectionImage. It is also automatically removed as a sink of any such prior sources which are no longer sources.

Overrides:
setSources in class PlanarImage
Parameters:
sourceList - A List of sources.
Throws:
IllegalArgumentException - if sourceList is null.

removeSources

public void removeSources()
Removes all the sources stored in the ParameterBlock of this node. This is a convenience method that invokes setParameterBlock() and so adheres to the same event firing behavior.

The node is removed automatically as a sink of any source which is a PlanarImage or a CollectionImage.

Overrides:
removeSources in class PlanarImage

addSink

public void addSink(PlanarImage sink)
Adds a PlanarImage sink to the list of sinks of the node.

Note that the behavior of this method has changed as of Java Advanced Imaging 1.1. To obtain the previous behavior use getRendering().addSink(). The description of the previous behavior is as follows:

Renders the node if it has not already been rendered, and adds a PlanarImage sink to the list of sinks of the rendered image.

Note also that this class no longer overrides getSinks(). To obtain the previous behavior of getSinks() use getRendering().getSinks().

Overrides:
addSink in class PlanarImage
Throws:
IllegalArgumentException - if sink is null.

removeSink

public boolean removeSink(PlanarImage sink)
Removes a PlanarImage sink from the list of sinks of the node.

Note that the behavior of this method has changed as of Java Advanced Imaging 1.1. To obtain the previous behavior use getRendering().removeSink(). The description of the previous behavior is as follows:

Renders the node if it has not already been rendered, and removes a PlanarImage sink from the list of sinks of the rendered image.

Note also that this class no longer overrides getSinks(). To obtain the previous behavior of getSinks() use getRendering().getSinks().

Overrides:
removeSink in class PlanarImage
Throws:
IllegalArgumentException - if sink is null.

removeSinks

public void removeSinks()
Removes all sinks from the list of sinks of the node.
Overrides:
removeSinks in class PlanarImage
Since:
JAI 1.1

addSink

public boolean addSink(Object sink)
Adds a sink to the list of node sinks. If the sink is an instance of PropertyChangeListener it will be notified in the same manner as registered listeners for the changes to the "Rendering" property of this node as long as its WeakReference has not yet been cleared.
Overrides:
addSink in class PlanarImage
Throws:
IllegalArgumentException - if sink is null.
Since:
JAI 1.1

removeSink

public boolean removeSink(Object sink)
Removes a sink from the list of node sinks. If the sink is a PropertyChangeListener for the "Rendering" property of this node it will no longer be eligible for notification events indicating a change in this property.
Overrides:
removeSink in class PlanarImage
Throws:
IllegalArgumentException - if sink is null.
Since:
JAI 1.1

mapDestPoint

public Point2D mapDestPoint(Point2D destPt,
                            int sourceIndex)
Computes the position in the specified source that best matches the supplied destination image position. If it is not possible to compute the requested position, null will be returned. If the point is mapped outside the source bounds, the coordinate value or null may be returned at the discretion of the implementation.

If the rendering of the node is an OpImage, the call is forwarded to the equivalent method of the rendering. Otherwise destPt is returned to indicate the identity mapping. In either case if the node had not been rendered it will be.

Parameters:
destPt - the position in destination image coordinates to map to source image coordinates.
sourceIndex - the index of the source image.
Returns:
a Point2D of the same class as destPt or null.
Throws:
IllegalArgumentException - if destPt is null.
IndexOutOfBoundsException - if sourceIndex is negative or greater than or equal to the number of sources.
Since:
JAI 1.1.2

mapSourcePoint

public Point2D mapSourcePoint(Point2D sourcePt,
                              int sourceIndex)
Computes the position in the destination that best matches the supplied source image position. If it is not possible to compute the requested position, null will be returned. If the point is mapped outside the destination bounds, the coordinate value or null may be returned at the discretion of the implementation.

If the rendering of the node is an OpImage, the call is forwarded to the equivalent method of the rendering. Otherwise sourcePt is returned to indicate the identity mapping. In either case if the node had not been rendered it will be.

Parameters:
sourcePt - the position in source image coordinates to map to destination image coordinates.
sourceIndex - the index of the source image.
Returns:
a Point2D of the same class as sourcePt or null.
Throws:
IllegalArgumentException - if sourcePt is null.
IndexOutOfBoundsException - if sourceIndex is negative or greater than or equal to the number of sources.
Since:
JAI 1.1.2

dispose

public void dispose()
Hints that this node and its rendering will no longer be used.

If theImage is non-null, then this call is first forwarded to theImage.dispose(). Subsequent to this super.dispose() is invoked.

The results of referencing an image after a call to dispose() are undefined.

Overrides:
dispose in class PlanarImage
Since:
JAI 1.1.2