|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.ImageMIPMap
A class implementing the "MIP map" operation on a
RenderedImage
. Given a RenderedImage
,
which represents the image at the highest resolution level, the
image at each lower resolution level may be derived by performing a
specific chain of operations to down sample the image at the next
higher resolution level repeatedly. The highest resolution level is
defined as level 0.
The downSampler
is a chain of operations that is
used to derive the image at the next lower resolution level from
the image at the current resolution level. That is, given an image
at resolution level i
, the downSampler
is
used to obtain the image at resolution level i+1
.
The chain may contain one or more operation nodes; however, each
node must be a RenderedOp
. The parameter points to the
last node in the chain. The very first node in the chain must be
a RenderedOp
that takes one RenderedImage
as its source. All other nodes may have multiple sources. When
traversing back up the chain, if a node has more than one source,
the first source, source0
, is used to move up the
chain. This parameter is saved by reference.
ImagePyramid
Field Summary | |
protected RenderedImage |
currentImage
The image at the current resolution level. |
protected int |
currentLevel
The current resolution level. |
protected RenderedOp |
downSampler
The operation chain used to derive the lower resolution images. |
protected PropertyChangeSupportJAI |
eventManager
A helper object to manage firing events. |
protected RenderedImage |
highestImage
The image with the highest resolution. |
protected WritablePropertySourceImpl |
properties
A helper object to manage the image properties. |
Constructor Summary | |
protected |
ImageMIPMap()
The default constructor. |
|
ImageMIPMap(RenderedImage image,
AffineTransform transform,
Interpolation interpolation)
Constructor. |
|
ImageMIPMap(RenderedImage image,
RenderedOp downSampler)
Constructor. |
|
ImageMIPMap(RenderedOp downSampler)
Constructs a new ImageMIPMap from a
RenderedOp chain. |
Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. |
protected RenderedOp |
duplicate(RenderedOp op,
Vector images)
Duplicates a RenderedOp chain. |
RenderableImage |
getAsRenderable()
Returns the current image as a RenderableImage . |
RenderableImage |
getAsRenderable(int numImages,
float minX,
float minY,
float height)
Returns the current image as a RenderableImage . |
RenderedImage |
getCurrentImage()
Returns the image at the current resolution level. |
int |
getCurrentLevel()
Returns the current resolution level. |
RenderedImage |
getDownImage()
Returns the image at the next lower resolution level, obtained by applying the downSampler on the
image at the current resolution level. |
RenderedImage |
getImage(int level)
Returns the image at the specified resolution level. |
Object |
getProperty(String name)
Returns the specified property. |
Class |
getPropertyClass(String name)
Returns the class expected to be returned by a request for the property with the specified name. |
String[] |
getPropertyNames()
Returns an array of String s recognized as names by
this property source. |
String[] |
getPropertyNames(String prefix)
Returns an array of String s recognized as names by
this property source that begin with the supplied prefix. |
void |
removeProperty(String name)
Removes the named property from the ImageMIPMap . |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. |
void |
setProperty(String name,
Object value)
Sets a property on a ImageMIPMap . |
protected Vector |
vectorize(RenderedImage image)
Creates and returns a Vector containing a single
element equal to the supplied RenderedImage . |
protected Vector |
vectorize(RenderedImage im1,
RenderedImage im2)
Creates and returns a Vector containing two
elements equal to the supplied RenderedImage s
in the order given. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected RenderedImage highestImage
protected RenderedImage currentImage
protected int currentLevel
protected RenderedOp downSampler
protected PropertyChangeSupportJAI eventManager
protected WritablePropertySourceImpl properties
Constructor Detail |
protected ImageMIPMap()
public ImageMIPMap(RenderedImage image, AffineTransform transform, Interpolation interpolation)
AffineTransform
and
Interpolation
objects.
All input parameters are saved by reference.image
- The image with the highest resolution.transform
- An affine matrix used with an "affine" operation
to derive the lower resolution images.interpolation
- The interpolation method for the "affine"
operation. It may be null
, in which case the
default "nearest neighbor" interpolation method is used.IllegalArgumentException
- if image
is
null
.IllegalArgumentException
- if transform
is
null
.public ImageMIPMap(RenderedImage image, RenderedOp downSampler)
downSampler
points to the last
operation node in the RenderedOp
chain. The very
first operation in the chain must not have any source images
specified; that is, its number of sources must be 0. All input
parameters are saved by reference.image
- The image with the highest resolution.downSampler
- The operation chain used to derive the lower
resolution images. No validation is done on the first
operation in the chain.IllegalArgumentException
- if image
is null
.IllegalArgumentException
- if downSampler
is
null
.public ImageMIPMap(RenderedOp downSampler)
ImageMIPMap
from a
RenderedOp
chain. The downSampler
points to the last operation node in the
RenderedOp
chain. The source image is determined
by traversing up the chain: starting at the bottom node, given by
the downSample
parameter, we move to the first
source of the node and repeat until we find either a sourceless
RenderedOp
or any other type of
RenderedImage
.
The downSampler
parameter is saved by reference
and should not be modified during the lifetime of any
ImageMIPMap
referring to it.downSampler
- The operation chain used to derive the lower
resolution images. The source of the first node in this
chain is taken as the image with the highest resolution.IllegalArgumentException
- if downSampler
is
null
.IllegalArgumentException
- if downSampler
has no sources.IllegalArgumentException
- if an object other than a
RenderedImage
is found in the
downSampler
chain.Method Detail |
public String[] getPropertyNames()
String
s recognized as names by
this property source. If no property names match,
null
will be returned.
The default implementation returns null
, i.e.,
no property names are recognized.
getPropertyNames
in interface PropertySource
String
s giving the valid
property names.public String[] getPropertyNames(String prefix)
String
s recognized as names by
this property source that begin with the supplied prefix. If
no property names are recognized, or no property names match,
null
will be returned.
The comparison is done in a case-independent manner.getPropertyNames
in interface PropertySource
prefix
- the supplied prefix for the property source.String
s giving the valid
property names.IllegalArgumentException
- if prefix
is
null
.public Class getPropertyClass(String name)
null
will be returned.getPropertyClass
in interface PropertySource
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
.getProperty
in interface PropertySource
name
- The name of the property.IllegalArgumentException
- if name
is null
.public void setProperty(String name, Object value)
ImageMIPMap
.setProperty
in interface WritablePropertySource
name
- a String
containing the property's name.value
- the property, as a general Object
.IllegalArgumentException
- If name
or
value
is null
.public void removeProperty(String name)
ImageMIPMap
.removeProperty
in interface WritablePropertySource
IllegalArgumentException
- if name
is null
.public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface PropertyChangeEmitter
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
addPropertyChangeListener
in interface PropertyChangeEmitter
public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface PropertyChangeEmitter
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
removePropertyChangeListener
in interface PropertyChangeEmitter
public int getCurrentLevel()
public RenderedImage getCurrentImage()
public RenderedImage getImage(int level)
null
will be returned.level
- The specified level of resolutionpublic RenderedImage getDownImage()
downSampler
on the
image at the current resolution level.protected RenderedOp duplicate(RenderedOp op, Vector images)
RenderedOp
chain. Each node in the
chain must be a RenderedOp
. The op
parameter points to the last RenderedOp
in the chain.
The very first op in the chain must have no sources and its source
will be set to the supplied image vector. When traversing up the
chain, if any node has more than one source, the first source will
be used. The first source of each node is duplicated; all other
sources are copied by reference.op
- RenderedOp chainvector
- of source imagesIllegalArgumentException
- if op
is null
.IllegalArgumentException
- if images
is null
.public RenderableImage getAsRenderable(int numImages, float minX, float minY, float height)
RenderableImage
.
This method returns a MultiResolutionRenderableImage
.
The numImages
parameter indicates the number of
RenderedImage
s used to construct the
MultiResolutionRenderableImage
. Starting with the
current image, the images are obtained by finding the necessary
number of lower resolution images using the downSampler
.
The current level and current image will not be changed.
If the width or height reaches 1, the downsampling will stop
and return the renderable image.
The numImages
should be greater than or equal to 1.
If a value of less than 1 is specified, this method uses 1 image,
which is the current image.
numImages
- The number of lower resolution images.minX
- The minimum X coordinate of the Renderable, as a float.minY
- The minimum Y coordinate of the Renderable, as a float.height
- The height of the Renderable, as a float.IllegalArgumentException
- if height
is less than 0.MultiResolutionRenderableImage
public RenderableImage getAsRenderable()
RenderableImage
.
This method returns a MultiResolutionRenderableImage
with the current image as the only source image, minX and minY
set to 0.0, and height set to 1.0.MultiResolutionRenderableImage
protected final Vector vectorize(RenderedImage image)
Vector
containing a single
element equal to the supplied RenderedImage
.protected final Vector vectorize(RenderedImage im1, RenderedImage im2)
Vector
containing two
elements equal to the supplied RenderedImage
s
in the order given.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |