Monday, 23 July 2007

Creating Operations

There are four variations on methods for creating operations in the Renderable mode,
* createRenderable
* createRenderableNS
* createRenderable-Collection
* createRenderable-CollectionNS

Example:
RenderedOp im = JAI.createNS("operationName", source, param1, param2);

The operation name is always enclosed in quotation marks. The operation name parsing is case-insensitive.

The parameter block contains the source of the operation and a set parameters used by the operation.

These controlling parameters and sources can be edited through the setParameterBlock method to affect specific operations or even the structure of the rendering chain itself.

There are two separate classes for specifying parameter blocks:
* java.awt.image.renderable.ParameterBlock - the main class for specifying and changing parameter blocks.
* javax.media.jai.ParameterBlockJAI - extends ParameterBlock by allowing the use of default parameter values and the use of parameter names.

Adding Sources to a Parameter BlocK
Example:
ParameterBlock pb = new ParameterBlock();
pb.addSource(im0);
pb.addSource(im1);

There are two separate classes for specifying parameter blocks: ParameterBlock and ParameterBlockJAI.
ParameterBlockJAI automatically provides default parameter values and allows setting parameters by name; ParameterBlock does not.

API: java.awt.image.renderable.ParameterBlock
The operation parameters are added to a ParameterBlock with the ParameterBlock.add() method.

Since the ParameterBlockJAI object already contains default values for the parameters at the time of construction, the parameters must be changed (or set) with the ParameterBlockJAI.set(value, index) methods rather than the add() method.

No comments: