|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.PlanarImage | +--javax.media.jai.RenderedOp
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 Vector
s within their respective
ParameterBlock
s 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:
validateArguments()
method of the associated
OperationDescriptor
, the arguments (sources and parameters)
are validated as being compatible with the specified operation.RenderingHints
maintained by the JAI
instance are merged with the local RenderingHints
with the
local hints taking precedence.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
RenderedImage
s is created. Each node in the chain of
RenderedOp
s corresponds to a node in the chain of
RenderedImage
s. 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
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 RenderingChangeEvent
s as described below.
RenderedOp
nodes may participate in Java Bean-style
events. The PropertyChangeEmitter
methods may be used
to register and unregister PropertyChangeListener
s.
RenderedOp
s are also PropertyChangeListener
s
so that they may be registered as listeners of other
PropertyChangeEmitter
s or the equivalent. Each
RenderedOp
also automatically receives any
RenderingChangeEvent
s emitted by any of its sources which
are also RenderedOp
s or any CollectionChangeEvent
s
from any CollectionOp
sources.
Certain PropertyChangeEvent
s may be emitted by the
RenderedOp
. These include the
PropertyChangeEventJAI
s and
PropertySourceChangeEvent
s 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:
RenderingChangeEvent
from one of
its RenderedOp
sources or a CollectionChangeEvent
from one of its CollectionOp
sources. 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 RenderedImage
s such as TiledImage
s.
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
PropertyChangeListener
s of the node, and to any sinks that
are PropertyChangeListener
s. 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 WritablePropertySource
s
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 PropertyGenerator
s, 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:
PropertyGenerator
s, or
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
SerializableRenderedImage
s 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 RenderableImage
s and
CollectionImage
s, respectively.
CollectionOp
,
JAI
,
OperationDescriptor
,
OperationRegistry
,
OpImage
,
RenderableOp
,
RenderingChangeEvent
,
SerializableRenderedImage
,
Serializer
,
SerializerFactory
,
RenderingHints
,
ParameterBlock
,
RenderedImageFactory
, Serialized FormField 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 Raster s. |
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 in t. |
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 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 |
protected OperationNodeSupport nodeSupport
OperationNode
.protected transient PropertySource thePropertySource
PropertySource
containing the combined properties
of all of the node's sources.protected transient PlanarImage theImage
Constructor Detail |
public RenderedOp(OperationRegistry registry, String opName, ParameterBlock pb, RenderingHints hints)
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.
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.IllegalArgumentException
- if opName
is
null
.public RenderedOp(String opName, ParameterBlock pb, RenderingHints hints)
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.
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.IllegalArgumentException
- if opName
is
null
.Method Detail |
public String getRegistryModeName()
RegistryMode
corresponding to
this RenderedOp
. This method always returns the
String
"rendered".getRegistryModeName
in interface OperationNode
public OperationRegistry getRegistry()
OperationRegistry
that is used
by this node. If the registry is not set, the default
registry is returned.getRegistry
in interface OperationNode
public void setRegistry(OperationRegistry registry)
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.
setRegistry
in interface OperationNode
registry
- The new OperationRegistry
to be set;
it may be null
.public String getOperationName()
String
.getOperationName
in interface OperationNode
public void setOperationName(String opName)
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.
setOperationName
in interface OperationNode
opName
- The new operation name to be set.IllegalArgumentException
- if opName
is
null
.public ParameterBlock getParameterBlock()
ParameterBlock
of this node.getParameterBlock
in interface OperationNode
public void setParameterBlock(ParameterBlock pb)
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
.
setParameterBlock
in interface OperationNode
pb
- The new ParameterBlock
to be set;
it may be null
.public RenderingHints getRenderingHints()
RenderingHints
of this node or
null
.getRenderingHints
in interface OperationNode
public void setRenderingHints(RenderingHints hints)
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.
setRenderingHints
in interface OperationNode
hints
- The new RenderingHints
to be set;
it may be null
.public PlanarImage createInstance()
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()
.
PlanarImage
.RuntimeException
- if the image factory charged with rendering
the node is unable to create a rendering.protected PlanarImage createInstance(boolean isNodeRendered)
createInstance()
optionally marking the node as rendered
according to the parameter.RuntimeException
- if the image factory charged with rendering
the node is unable to create a rendering.createInstance()
protected void createRendering()
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.RuntimeException
- if the image factory charged with rendering
the node is unable to create a rendering.createInstance()
public PlanarImage getRendering()
PlanarImage
rendering associated with this
RenderedOp
node. This method performs the same action
as createRendering()
but returns theImage
.RuntimeException
- if the image factory charged with rendering
the node is unable to create a rendering.createRendering()
,
createInstance()
public PlanarImage getCurrentRendering()
theImage
which may be null
if no rendering has yet been created.
This method does not force the node to be rendered.public PlanarImage getNewRendering()
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
PropertyChangeListener
s 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.
RenderingChangeEvent
listeners.public void propertyChange(PropertyChangeEvent evt)
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 RenderingChangeEvent
s.
propertyChange
in interface PropertyChangeListener
TiledImage.propertyChange(java.beans.PropertyChangeEvent)
public void addNodeSource(Object source)
addSource(Object)
.
ParameterBlock
of this node.
This is a convenience method that invokes
setParameterBlock()
and so adheres to the same event
firing behavior.source
- The source to be added to the
ParameterBlock
public void setNodeSource(Object source, int index)
setSource(Object,int)
.
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.source
- The Source to be set.index
- The Index at which it is to be set.IllegalArgumentException
- if
source
is null
.ArrayIndexOutOfBoundsException
- if
index
is invalid.public Object getNodeSource(int index)
getSourceObject(int)
.
ParameterBlock
of this node.
If there is no source corresponding to the specified index, an
ArrayIndexOutOfBoundsException
will be thrown.index
- The index of the source.public int getNumParameters()
ParameterBlock
of this node.public Vector getParameters()
Vector
of parameters stored in the
ParameterBlock
of this node.public byte getByteParameter(int index)
ParameterBlock
of this node as a byte
.
An ArrayIndexOutOfBoundsException
may occur if an
invalid index is suppliedindex
- The index of the parameter.ArrayIndexOutOfBoundsException
- if
index
is invalid.public char getCharParameter(int index)
ParameterBlock
of this node as a char
.
An ArrayIndexOutOfBoundsException
may occur if an
invalid index is suppliedindex
- The index of the parameter.ArrayIndexOutOfBoundsException
- if
index
is invalid.public short getShortParameter(int index)
ParameterBlock
of this node as a short
.
An ArrayIndexOutOfBoundsException
may occur if an
invalid index is suppliedindex
- The index of the parameter.ArrayIndexOutOfBoundsException
- if
index
is invalid.public int getIntParameter(int index)
ParameterBlock
of this node as an int
.
An ArrayIndexOutOfBoundsException
may occur if an
invalid index is suppliedindex
- The index of the parameter.ArrayIndexOutOfBoundsException
- if
index
is invalid.public long getLongParameter(int index)
ParameterBlock
of this node as a long
.
An ArrayIndexOutOfBoundsException
may occur if an
invalid index is suppliedindex
- The index of the parameter.ArrayIndexOutOfBoundsException
- if
index
is invalid.public float getFloatParameter(int index)
ParameterBlock
of this node as a float
.
An ArrayIndexOutOfBoundsException
may occur if an
invalid index is suppliedindex
- The index of the parameter.ArrayIndexOutOfBoundsException
- if
index
is invalid.public double getDoubleParameter(int index)
ParameterBlock
of this node as a double
.
An ArrayIndexOutOfBoundsException
may occur if an
invalid index is suppliedindex
- The index of the parameter.ArrayIndexOutOfBoundsException
- if
index
is invalid.public Object getObjectParameter(int index)
ParameterBlock
of this node as an Object
.
An ArrayIndexOutOfBoundsException
may occur if an
invalid index is suppliedindex
- The index of the parameter.ArrayIndexOutOfBoundsException
- if
index
is invalid.public void setParameters(Vector parameters)
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.
public void setParameter(byte param, int index)
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.param
- The parameter, as a byte
.index
- The index of the parameter.public void setParameter(char param, int index)
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.param
- The parameter, as a char
.index
- The index of the parameter.public void setParameter(short param, int index)
short
.
If the index
lies beyond the current source list,
the list is extended with nulls as needed.param
- The parameter, as a short
.index
- The index of the parameter.public void setParameter(int param, int index)
in
t.
If the index
lies beyond the current source list,
the list is extended with nulls as needed.param
- The parameter, as an int
.index
- The index of the parameter.public void setParameter(long param, int index)
long
.
If the index
lies beyond the current source list,
the list is extended with nulls as needed.param
- The parameter, as a long
.index
- The index of the parameter.public void setParameter(float param, int index)
float
.
If the index
lies beyond the current source list,
the list is extended with nulls as needed.param
- The parameter, as a float
.index
- The index of the parameter.public void setParameter(double param, int index)
double
.
If the index
lies beyond the current source list,
the list is extended with nulls as needed.param
- The parameter, as a double
.index
- The index of the parameter.public void setParameter(Object param, int index)
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.
param
- The parameter, as an Object
.index
- The index of the parameter.public void setRenderingHint(RenderingHints.Key key, Object value)
RenderingHints
of this node. This
is a convenience method which calls setRenderingHints()
and so adheres to the same event firing behavior.IllegalArgumentException
- if the key or value is null
.IllegalArgumentException
- value is not appropriate for the specified key.public Object getRenderingHint(RenderingHints.Key key)
RenderingHints
of this node.null
if the key is not mapped to any value.protected void resetProperties(boolean resetPropertySource)
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.public String[] getPropertyNames()
getPropertyNames
in interface PropertySource
getPropertyNames
in class PlanarImage
String
s containing valid
property names.public Class getPropertyClass(String name)
null
will be returned.getPropertyClass
in interface PropertySource
getPropertyClass
in class PlanarImage
Class
expected to be return by a
request for the value of this property or null
.IllegalArgumentException
- if name
is null
.public Object getProperty(String name)
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.getProperty
in interface PropertySource
getProperty
in class PlanarImage
name
- A String
naming the property.IllegalArgumentException
- if
name
is null
.public void setProperty(String name, Object value)
If the node is serialized then serializable properties will also be serialized but non-serializable properties will be lost.
setProperty
in class PlanarImage
name
- A String
representing the property name.value
- The property's value, as an Object
.IllegalArgumentException
- if
name
is null
.IllegalArgumentException
- if
value
is null
.RuntimeException
- if name
conflicts with Synthetic property.public void removeProperty(String name)
RenderedOp
as well as from its property
environment. The synthetic properties
(containing image width, height, and position) may not be removed.removeProperty
in class PlanarImage
IllegalArgumentException
- if name
is null
.RuntimeException
- if name
conflicts with Synthetic property.public Object getDynamicProperty(String name)
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
PropertyGenerator
s are registered or in the values
associated with properties of node sources. The case of the property
name passed to this method is ignored.getDynamicProperty
in interface OperationNode
name
- A String
naming the property.IllegalArgumentException
- if
name
is null
.public void addPropertyGenerator(PropertyGenerator pg)
PropertyGenerator
to the node. The property values
emitted by this property generator override any previous
definitions.addPropertyGenerator
in interface OperationNode
pg
- A PropertyGenerator
to be added to this node's
property environment.IllegalArgumentException
- if
pg
is null
.public void copyPropertyFromSource(String propertyName, int sourceIndex)
copyPropertyFromSource
in interface OperationNode
propertyName
- the name of the property to be copied.sourceIndex
- the index of the from which to copy the property.IllegalArgumentException
- if propertyName
is
null
.public void suppressProperty(String name)
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.suppressProperty
in interface OperationNode
name
- A String
naming the property to be suppressed.IllegalArgumentException
- if
name
is null
.IllegalArgumentException
- if name
conflicts with Synthetic property.public int getMinX()
getMinX
in class PlanarImage
public int getMinY()
getMinY
in class PlanarImage
public int getWidth()
getWidth
in class PlanarImage
public int getHeight()
getHeight
in class PlanarImage
public int getTileWidth()
getTileWidth
in class PlanarImage
public int getTileHeight()
getTileHeight
in class PlanarImage
public int getTileGridXOffset()
getTileGridXOffset
in class PlanarImage
public int getTileGridYOffset()
getTileGridYOffset
in class PlanarImage
public SampleModel getSampleModel()
SampleModel
of the rendered image.getSampleModel
in class PlanarImage
public ColorModel getColorModel()
ColorModel
of the rendered image.getColorModel
in class PlanarImage
public Raster getTile(int tileX, int tileY)
getTile
in class PlanarImage
tileX
- The X index of the tile.tileY
- The Y index of the tile.Raster
.public Raster getData()
Raster
.getData
in class PlanarImage
javax.media.jai.PlanarImage
Raster
containing the entire image data.IllegalArgumentException
- If the size of the returned data
is too large to be stored in a single Raster
.public Raster getData(Rectangle rect)
Raster
.getData
in class PlanarImage
javax.media.jai.PlanarImage
region
- The rectangular region of this image to be
returned, or null
.Raster
containing the specified image data.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
.public WritableRaster copyData()
copyData
in class PlanarImage
public WritableRaster copyData(WritableRaster raster)
WritableRaster
.copyData
in class PlanarImage
raster
- A WritableRaster
to be filled with image data.WritableRaster
.public Raster[] getTiles(Point[] tileIndices)
tileIndices
of the rendered image as an array of Raster
s.getTiles
in class PlanarImage
tileIndices
- An array of Points representing TileIndices.IllegalArgumentException
- If tileIndices
is
null
.public TileRequest queueTiles(Point[] tileIndices)
RenderedOp
itself in fact should monitor any
TileComputationListener
events of its rendering and
forward any such events to any of its registered listeners.queueTiles
in class PlanarImage
tileIndices
- A list of tile indices indicating which tiles
to schedule for computation.IllegalArgumentException
- If tileIndices
is
null
.public void cancelTiles(TileRequest request, Point[] tileIndices)
cancelTiles
in class PlanarImage
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.IllegalArgumentException
- If request
is
null
.public void prefetchTiles(Point[] tileIndices)
prefetchTiles
in class PlanarImage
tileIndices
- A list of tileIndices indicating which tiles
to prefetch.IllegalArgumentException
- If tileIndices
is
null
.public void addSource(PlanarImage source)
addSource(Object)
.
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.
source
- The source to be added to the
ParameterBlock
IllegalArgumentException
- if source
is
null
.public void setSource(PlanarImage source, int index)
setSource(Object, int)
.
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.
source
- The source, as a PlanarImage
.index
- The index of the source.IllegalArgumentException
- if source
is
null
.ArrayIndexOutOfBoundsException
- if
index
is invalid.public PlanarImage getSource(int index)
getSourceObject()
.
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.
getSource
in class PlanarImage
index
- The index of the desired source.PlanarImage
source.ArrayIndexOutOfBoundsException
- if
index
is invalid.ClassCastException
- if the source at the indicated index is
not a PlanarImage
.public boolean removeSource(PlanarImage source)
removeSource(Object)
.
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.
source
- A PlanarImage
to be removed.true
if the element was present, false
otherwise.IllegalArgumentException
- if
source
is null
.public void addSource(Object source)
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
.
addSource
in class PlanarImage
source
- The source to be added to the
ParameterBlock
IllegalArgumentException
- if
source
is null
.public void setSource(Object source, int index)
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.
setSource
in class PlanarImage
source
- The Source to be set.index
- The Index at which it is to be set.IllegalArgumentException
- if
source
is null
.ArrayIndexOutOfBoundsException
- if
index
is invalid.public boolean removeSource(Object source)
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
.
removeSource
in class PlanarImage
source
- A Object
to be removed.true
if the element was present, false
otherwise.IllegalArgumentException
- if
source
is null
.public PlanarImage getSourceImage(int index)
PlanarImage
source stored in the
ParameterBlock
of this node.
If there is no source corresponding to the specified index, an
ArrayIndexOutOfBoundsException
will be thrown.getSourceImage
in class PlanarImage
index
- The index of the desired source.PlanarImage
source.ArrayIndexOutOfBoundsException
- if
index
is invalid.ClassCastException
- if the source at the indicated index is
not a PlanarImage
.public Object getSourceObject(int index)
ParameterBlock
of this node.
If there is no source corresponding to the specified index, an
ArrayIndexOutOfBoundsException
will be thrown.getSourceObject
in class PlanarImage
index
- The index of the source.ArrayIndexOutOfBoundsException
- if
index
is invalid.public int getNumSources()
ParameterBlock
of this node.
This may differ from the number of sources of the rendered image.getNumSources
in class PlanarImage
public Vector getSources()
Vector
of sources stored in the
ParameterBlock
of this node.
This may differ from the source vector of the rendering of the node.getSources
in class PlanarImage
public void setSources(List sourceList)
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.
setSources
in class PlanarImage
sourceList
- A List
of sources.IllegalArgumentException
- if
sourceList
is null
.public void removeSources()
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
.
removeSources
in class PlanarImage
public void addSink(PlanarImage sink)
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()
.
addSink
in class PlanarImage
IllegalArgumentException
- if
sink
is null
.public boolean removeSink(PlanarImage sink)
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()
.
removeSink
in class PlanarImage
IllegalArgumentException
- if
sink
is null
.public void removeSinks()
removeSinks
in class PlanarImage
public boolean addSink(Object sink)
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.addSink
in class PlanarImage
IllegalArgumentException
- if
sink
is null
.public boolean removeSink(Object sink)
PropertyChangeListener
for the "Rendering"
property of this node it will no longer be eligible for
notification events indicating a change in this property.removeSink
in class PlanarImage
IllegalArgumentException
- if
sink
is null
.public Point2D mapDestPoint(Point2D destPt, int sourceIndex)
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.
destPt
- the position in destination image coordinates
to map to source image coordinates.sourceIndex
- the index of the source image.Point2D
of the same class as
destPt
or null
.IllegalArgumentException
- if destPt
is
null
.IndexOutOfBoundsException
- if sourceIndex
is
negative or greater than or equal to the number of sources.public Point2D mapSourcePoint(Point2D sourcePt, int sourceIndex)
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.
sourcePt
- the position in source image coordinates
to map to destination image coordinates.sourceIndex
- the index of the source image.Point2D
of the same class as
sourcePt
or null
.IllegalArgumentException
- if sourcePt
is
null
.IndexOutOfBoundsException
- if sourceIndex
is
negative or greater than or equal to the number of sources.public void dispose()
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.
dispose
in class PlanarImage
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |