Package org.apache.sis.image
Class PixelIterator.Window<T extends Buffer>
java.lang.Object
org.apache.sis.image.PixelIterator.Window<T>
- Type Parameters:
T
- the type of buffer which can be used for transferring data.
- Direct Known Subclasses:
BandedIterator.DoubleWindow
,BandedIterator.FloatWindow
,PixelIterator.DoubleWindow
,PixelIterator.FloatWindow
,PixelIterator.IntWindow
- Enclosing class:
PixelIterator
Contains the sample values in a moving window over the image. Windows are created by calls to
PixelIterator.createWindow(TransferType)
and sample values are stored in Buffer
s.
The buffer content is replaced ever time update()
is invoked.- Since:
- 0.8
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
Enumeration values for the last argument ingetPixels(Raster, int, int, int, int, int)
.(package private) static final int
Enumeration values for the last argument ingetPixels(Raster, int, int, int, int, int)
.(package private) static final int
Enumeration values for the last argument ingetPixels(Raster, int, int, int, int, int)
.final T
A buffer containing all sample values fetched by the last call toupdate()
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract Object
Returns an array containing all samples for a rectangle of pixels in the given raster, one sample per array element.final Dimension
getSize()
Returns the width and height of this window in pixels.(package private) abstract PixelIterator
owner()
Returns the iterator that created this window.abstract void
update()
Updates this window with the sample values in the region starting at current iterator position.
-
Field Details
-
DIRECT
static final int DIRECTEnumeration values for the last argument ingetPixels(Raster, int, int, int, int, int)
.DIRECT
: store sample values directly in the final destination array.TRANSFER
: store sample values in a temporary buffer (copied to destination by caller).TRANSFER_FROM_OTHER
: same asTRANSFER
, but also notify that the given raster is notPixelIterator.currentRaster
.
- See Also:
-
TRANSFER
static final int TRANSFEREnumeration values for the last argument ingetPixels(Raster, int, int, int, int, int)
.DIRECT
: store sample values directly in the final destination array.TRANSFER
: store sample values in a temporary buffer (copied to destination by caller).TRANSFER_FROM_OTHER
: same asTRANSFER
, but also notify that the given raster is notPixelIterator.currentRaster
.
- See Also:
-
TRANSFER_FROM_OTHER
static final int TRANSFER_FROM_OTHEREnumeration values for the last argument ingetPixels(Raster, int, int, int, int, int)
.DIRECT
: store sample values directly in the final destination array.TRANSFER
: store sample values in a temporary buffer (copied to destination by caller).TRANSFER_FROM_OTHER
: same asTRANSFER
, but also notify that the given raster is notPixelIterator.currentRaster
.
- See Also:
-
values
A buffer containing all sample values fetched by the last call toupdate()
. The buffer capacity is (number of bands) × (window width) × (window height). Values are always stored with band index varying fastest, then column index, then row index. Columns are traversed from left to right and rows are traversed from top to bottom (linear iteration order). That order is the same regardless the iteration order of enclosing iterator.Every time that
update()
is invoked, the buffer content is replaced by sample values starting at the current iterator position. Before the firstupdate()
invocation, the buffer is filled with zero values.
-
-
Constructor Details
-
Window
Window(T buffer) Creates a new window which will store the sample values in the given buffer.
-
-
Method Details
-
owner
Returns the iterator that created this window. -
getSize
Returns the width and height of this window in pixels.- Returns:
- the window size in pixels.
- Since:
- 1.1
-
update
public abstract void update()Updates this window with the sample values in the region starting at current iterator position. The buffer position, limit and mark are cleared.The
PixelIterator.next()
method must have returnedtrue
, or thePixelIterator.moveTo(int,int)
method must have been invoked successfully, before thisupdate()
method is invoked. If above condition is not met, then this method behavior is undefined: it may throw any runtime exception or return meaningless values (there is no explicit bounds check for performance reasons). -
getPixels
Returns an array containing all samples for a rectangle of pixels in the given raster, one sample per array element. Subclasses should delegate to one of theRaster#getPixels(…)
methods depending on the buffer data type.Constraints
subWidth
andsubHeight
shall always be greater than zero.- Parameters:
raster
- the raster from which to get the pixel values.subX
- the X coordinate of the upper-left pixel location.subY
- the Y coordinate of the upper-left pixel location.subWidth
- width of the pixel rectangle.subHeight
- height of the pixel rectangle.mode
- one ofDIRECT
,TRANSFER
orTRANSFER_FROM_OTHER
.- Returns:
- the array in which sample values have been stored.
-