|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jaitools.imageutils.iterator.AbstractSimpleIterator
public abstract class AbstractSimpleIterator
Base class for image iterators with row-column (line-pixel) movement.
| Nested Class Summary | |
|---|---|
protected static interface |
AbstractSimpleIterator.DelegateHelper
This is implemented by sub-classes to pass a method back to this class to create the delegate iterator. |
static class |
AbstractSimpleIterator.Order
Constants defining the visiting order that the iterator will follow when moved with the next() method. |
| Field Summary | |
|---|---|
protected javax.media.jai.iterator.RectIter |
delegateIter
The delegate iterator. |
protected int |
imageDataType
The data type of the target image (value of a DataBuffer constant). |
protected WeakReference<RenderedImage> |
imageRef
A weak reference to the target image. |
protected Rectangle |
iterBounds
The bounds of this iterator |
| Constructor Summary | |
|---|---|
AbstractSimpleIterator(AbstractSimpleIterator.DelegateHelper helper,
RenderedImage image,
Rectangle bounds,
Number outsideValue,
AbstractSimpleIterator.Order order)
Creates a new instance. |
|
| Method Summary | |
|---|---|
protected void |
checkBandArg(int band)
Helper method to check that a band value is valid. |
void |
done()
Closes this iterator and frees resources including the iterator's reference to the source image. |
Rectangle |
getBounds()
Gets the bounds of this iterator. |
Point |
getEndPos()
Gets the final position for this iterator. |
RenderedImage |
getImage()
Returns the image that this iterator is working with. |
Point |
getPos()
Gets the current iterator position. |
Point |
getPos(Point dest)
Gets the current iterator position. |
Number |
getSample()
Returns the value from the first band of the image at the current position, or the outside value if the iterator is positioned beyond the image bounds. |
Number |
getSample(int band)
Returns the value from the specified band of the image at the current position, or the outside value if the iterator is positioned beyond the image bounds. |
Number |
getSample(int x,
int y)
Returns the value from the first band of the image at the specified position, If the position is within the iterator's bounds, but outside the target image bounds, the outside value is returned. |
Number |
getSample(int x,
int y,
int band)
Returns the value from the specified band of the image at the specified position, If the position is within the iterator's bounds, but outside the target image bounds, the outside value is returned. |
Number |
getSample(Point pos)
Returns the value from the first band of the image at the specified position, If the position is within the iterator's bounds, but outside the target image bounds, the outside value is returned. |
Number |
getSample(Point pos,
int band)
Returns the value from the specified band of the image at the specified position, If the position is within the iterator's bounds, but outside the target image bounds, the outside value is returned. |
Point |
getStartPos()
Gets the starting position for this iterator. |
List<Rectangle> |
getSubBounds()
Gets the list of sub-bounds for this iterator. |
boolean |
hasNext()
Tests if this iterator can be advanced further, ie. |
protected boolean |
isInsideDelegateBounds()
Tests if the iterator is currently positioned inside the delegate iterator's area (which must lie within the image bounds). |
boolean |
isWithinImage()
Tests whether the iterator is currently positioned within the bounds of the target image. |
boolean |
next()
Advances the iterator to the next position. |
void |
reset()
Resets the iterator to its first position. |
protected void |
setDelegatePosition()
Sets the delegate iterator position. |
boolean |
setPos(int x,
int y)
Sets the iterator to a new position. |
boolean |
setPos(Point pos)
Sets the iterator to a new position. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final WeakReference<RenderedImage> imageRef
protected final int imageDataType
protected final Rectangle iterBounds
protected final javax.media.jai.iterator.RectIter delegateIter
| Constructor Detail |
|---|
public AbstractSimpleIterator(AbstractSimpleIterator.DelegateHelper helper,
RenderedImage image,
Rectangle bounds,
Number outsideValue,
AbstractSimpleIterator.Order order)
helper - a helper provided by sub-class to create the delegate iteratorimage - the target imagebounds - the bounds for this iterator; null means to use the
target image boundsoutsideValue - value to return when positioned outside the bounds of
the target imageorder - order of movement for this iterator
IllegalArgumentException - if the image argument is null| Method Detail |
|---|
public RenderedImage getImage()
null.
public Rectangle getBounds()
public List<Rectangle> getSubBounds()
When working in the default AbstractSimpleIterator.Order.IMAGE_X_Y processing order, this method will return a list containing a single rectangle, identical to that returned by getBounds().
The returned List and the Rectangles within it are copies, so the
iterator will not be affected by subsequent modifications to them.
public Point getStartPos()
public Point getEndPos()
public boolean isWithinImage()
true if within the target image; false otherwisepublic boolean hasNext()
next() would return true.
true if the iterator can be advanced;
false if it is at the end of its boundspublic boolean next()
true if the iterator was successfully advanced;
false if it was already at the end of its boundspublic void reset()
public Point getPos()
public Point getPos(Point dest)
dest is not null
it will be set to the current position and returned, otherwise a new
Point instance is returned. It is always safe to call this method.
public boolean setPos(Point pos)
true indicates that the new position was valid. If the new position
is equal to the iterator's current position this method will still
return true even though the iterator has not moved.
If the new position is outside this iterator's bounds, the position remains
unchanged and false is returned.
pos - the new position
true if the new position was valid; false
otherwise
IllegalArgumentException - if pos is null
public boolean setPos(int x,
int y)
true indicates that the new position was valid. If the new position
is equal to the iterator's current position this method will still
return true even though the iterator has not moved.
If the new position is outside this iterator's bounds, the position remains
unchanged and false is returned.
x - image X positiony - image Y position
true if the new position was valid; false
otherwisepublic Number getSample()
public Number getSample(Point pos)
If the position is outside the iterator's bounds, null is returned
and the iterator's position will remain unchanged.
pos - the position to sample
null
IllegalArgumentException - if pos is null
public Number getSample(int x,
int y)
If the position is outside the iterator's bounds, null is returned
and the iterator's position will remain unchanged.
x - sampling position X-ordinatey - sampling position Y-ordinate
nullpublic Number getSample(int band)
band - image band
IllegalArgumentException - if band is out of range for the the
target image
public Number getSample(Point pos,
int band)
If the position is outside the iterator's bounds, null is returned
and the iterator's position will remain unchanged.
pos - the position to sampleband - image band
null
IllegalArgumentException - if pos is null or
band is out of range
public Number getSample(int x,
int y,
int band)
If the position is outside the iterator's bounds, null is returned
and the iterator's position will remain unchanged.
x - sampling position X-ordinatey - sampling position Y-ordinateband - image band
null
IllegalArgumentException - if band is out of rangepublic void done()
protected void setDelegatePosition()
newPos is outside
the target image bounds, the delegate iterator does not move.
protected boolean isInsideDelegateBounds()
true if the current position is inside the delegate's bounds;
false otherwiseprotected void checkBandArg(int band)
band - band value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||