javax.media.jai
Class TiledImage

java.lang.Object
  extended byjavax.media.jai.PlanarImage
      extended byjavax.media.jai.TiledImage
All Implemented Interfaces:
EventListener, ImageJAI, PropertyChangeEmitter, PropertyChangeListener, PropertySource, RenderedImage, WritablePropertySource, WritableRenderedImage

public class TiledImage
extends PlanarImage
implements WritableRenderedImage, PropertyChangeListener

A concrete implementation of WritableRenderedImage.

TiledImage is the main class for writable images in JAI. TiledImage provides a straightforward implementation of the WritableRenderedImage interface, taking advantage of that interface's ability to describe images with multiple tiles. The tiles of a WritableRenderedImage must share a SampleModel, which determines their width, height, and pixel format. The tiles form a regular grid, which may occupy any rectangular region of the plane. Tile pixels the locations of which lie outside the stated image bounds have undefined values.

The contents of a TiledImage are defined by a single RenderedImage source provided by means of one of the set() methods or to a constructor which accepts a RenderedImage. The set() methods provide a way to selectively overwrite a portion of a TiledImage, possibly using a region of interest (ROI).

TiledImage also supports direct manipulation of pixels by means of the getWritableTile() method. This method returns a WritableRaster that can be modified directly. Such changes become visible to readers according to the regular thread synchronization rules of the Java virtual machine; JAI makes no additional guarantees. When a writer is finished modifying a tile, it should call releaseWritableTile(). A shortcut is to call setData(), which copies a rectangular region or an area specified by a ROI from a supplied Raster directly into the TiledImage.

A final way to modify the contents of a TiledImage is through calls to the object returned by createGraphics(). This returns a Graphics2D object that can be used to draw line art, text, and images in the usual Abstract Window Toolkit (AWT) manner.

A TiledImage does not attempt to maintain synchronous state on its own. That task is left to SnapshotImage. If a synchronous (unchangeable) view of a TiledImage is desired, its createSnapshot() method must be used. Otherwise, changes due to calls to set() or direct writing of tiles by objects that call getWritableTile() will be visible.

TiledImage does not actually cause its tiles to be copied from the specified source until their contents are demanded. Once a tile has been computed, its contents may be discarded if it can be determined that it can be recomputed identically from the source. The lockTile() method forces a tile to be computed and maintained for the lifetime of the TiledImage.

See Also:
SnapshotImage, RenderedImage, WritableRenderedImage

Field Summary
protected  int minTileX
          The index of the leftmost column of tiles.
protected  int minTileY
          The index of the uppermost row of tiles.
protected  Vector tileObservers
          The current set of TileObservers.
protected  WritableRaster[][] tiles
          The tile array.
protected  int tilesX
          The number of tiles in the X direction.
protected  int tilesY
          The number of tiles in the Y direction.
protected  int[][] writers
          The number of writers of each tile; -1 indicates a locked tile.
 
Fields inherited from class javax.media.jai.PlanarImage
colorModel, eventManager, height, minX, minY, properties, sampleModel, tileFactory, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width
 
Constructor Summary
TiledImage(int minX, int minY, int width, int height, int tileGridXOffset, int tileGridYOffset, SampleModel tileSampleModel, ColorModel colorModel)
          Constructs a TiledImage with a given layout, SampleModel, and ColorModel.
TiledImage(Point origin, SampleModel sampleModel, int tileWidth, int tileHeight)
          Deprecated. as of JAI 1.1.
TiledImage(RenderedImage source, boolean areBuffersShared)
          Constructs a TiledImage equivalent to a given RenderedImage.
TiledImage(RenderedImage source, int tileWidth, int tileHeight)
          Constructs a TiledImage equivalent to a given RenderedImage but with specific tile dimensions.
TiledImage(SampleModel sampleModel, int tileWidth, int tileHeight)
          Deprecated. as of JAI 1.1.
 
Method Summary
 void addTileObserver(TileObserver observer)
          Informs this TiledImage that another object is interested in being notified whenever any tile becomes writable or ceases to be writable.
 void clearTiles()
          Sets the tiles array to null so that the image may be used again.
static TiledImage createBanded(int minX, int minY, int width, int height, int dataType, int tileWidth, int tileHeight, int[] bankIndices, int[] bandOffsets)
          Deprecated. as of JAI 1.1.
 Graphics2D createGraphics()
          Creates a Graphics2D object that can be used to paint text and graphics onto the TiledImage.
static TiledImage createInterleaved(int minX, int minY, int width, int height, int numBands, int dataType, int tileWidth, int tileHeight, int[] bandOffsets)
          Deprecated. as of JAI 1.1.
 Graphics getGraphics()
          Deprecated. as of JAI 1.1.
 int getSample(int x, int y, int b)
          Returns the value of a given sample of a pixel as an int.
 double getSampleDouble(int x, int y, int b)
          Returns the value of a given sample of a pixel as a double.
 float getSampleFloat(int x, int y, int b)
          Returns the value of a given sample of a pixel as a float.
 TiledImage getSubImage(int[] bandSelect)
          Deprecated. as of JAI 1.1.
 TiledImage getSubImage(int[] bandSelect, ColorModel cm)
          Returns a TiledImage that shares the tile Rasters of this image.
 TiledImage getSubImage(int x, int y, int w, int h)
          Returns a TiledImage that shares the tile Rasters of this image.
 TiledImage getSubImage(int x, int y, int w, int h, int[] bandSelect)
          Deprecated. as of JAI 1.1.
 TiledImage getSubImage(int x, int y, int w, int h, int[] bandSelect, ColorModel cm)
          Returns a TiledImage that shares the tile Rasters of this image.
 Raster getTile(int tileX, int tileY)
          Retrieves a particular tile from the image for reading only.
 WritableRaster getWritableTile(int tileX, int tileY)
          Retrieves a particular tile from the image for reading and writing.
 Point[] getWritableTileIndices()
          Returns a list of tiles that are currently held by one or more writers or null of no tiles are so held.
 boolean hasTileWriters()
          Returns true if any tile is being held by a writer, false otherwise.
protected  boolean isTileLocked(int tileX, int tileY)
          Returns true if a tile is locked.
 boolean isTileWritable(int tileX, int tileY)
          Returns true if a tile has writers.
protected  boolean lockTile(int tileX, int tileY)
          Forces a tile to be computed, and its contents stored indefinitely.
 void propertyChange(PropertyChangeEvent evt)
          Implementation of PropertyChangeListener.
 void releaseWritableTile(int tileX, int tileY)
          Indicates that a writer is done updating a tile.
 void removeTileObserver(TileObserver observer)
          Informs this TiledImage that a particular TileObserver no longer wishes to receive updates on tile writability status.
 void set(RenderedImage im)
          Overlays a given RenderedImage on top of the current contents of the TiledImage.
 void set(RenderedImage im, ROI roi)
          Overlays a given RenderedImage on top of the current contents of the TiledImage and its intersection with the supplied ROI.
 void setData(Raster r)
          Sets a region of a TiledImage to be a copy of a supplied Raster.
 void setData(Raster r, ROI roi)
          Sets a region of a TiledImage to be a copy of a supplied Raster.
 void setSample(int x, int y, int b, double s)
          Sets a sample of a pixel to a given double value.
 void setSample(int x, int y, int b, float s)
          Sets a sample of a pixel to a given float value.
 void setSample(int x, int y, int b, int s)
          Sets a sample of a pixel to a given int value.
 
Methods inherited from class javax.media.jai.PlanarImage
addPropertyChangeListener, addPropertyChangeListener, addSink, addSink, addSource, addTileComputationListener, cancelTiles, copyData, copyData, copyExtendedData, createColorModel, createSnapshot, createWritableRaster, dispose, finalize, getAsBufferedImage, getAsBufferedImage, getBounds, getColorModel, getData, getData, getDefaultColorModel, getExtendedData, getHeight, getImageID, getMaxTileX, getMaxTileY, getMaxX, getMaxY, getMinTileX, getMinTileY, getMinX, getMinY, getNumBands, getNumSources, getNumXTiles, getNumYTiles, getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames, getSampleModel, getSinks, getSource, getSourceImage, getSourceObject, getSources, getSplits, getTileComputationListeners, getTileFactory, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileIndices, getTileRect, getTiles, getTiles, getTileWidth, getWidth, overlapsMultipleTiles, prefetchTiles, queueTiles, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeSink, removeSink, removeSinks, removeSource, removeSources, removeTileComputationListener, setImageLayout, setProperties, setProperty, setSource, setSources, tileXToX, tileXToX, tileYToY, tileYToY, toString, wrapRenderedImage, XToTileX, XToTileX, YToTileY, YToTileY
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.image.RenderedImage
copyData, getColorModel, getData, getData, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getProperty, getPropertyNames, getSampleModel, getSources, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidth
 

Field Detail

tilesX

protected int tilesX
The number of tiles in the X direction.


tilesY

protected int tilesY
The number of tiles in the Y direction.


minTileX

protected int minTileX
The index of the leftmost column of tiles.


minTileY

protected int minTileY
The index of the uppermost row of tiles.


tiles

protected WritableRaster[][] tiles
The tile array.


writers

protected int[][] writers
The number of writers of each tile; -1 indicates a locked tile.


tileObservers

protected Vector tileObservers
The current set of TileObservers.

Constructor Detail

TiledImage

public TiledImage(int minX,
                  int minY,
                  int width,
                  int height,
                  int tileGridXOffset,
                  int tileGridYOffset,
                  SampleModel tileSampleModel,
                  ColorModel colorModel)
Constructs a TiledImage with a given layout, SampleModel, and ColorModel. The width and height of the image tiles will be respectively equal to the width and height of the SampleModel. The tileFactory instance variable will be set to the value of the JAI.KEY_TILE_FACTORY hint set on the default instance of JAI.

Parameters:
minX - The X coordinate of the upper-left pixel
minY - The Y coordinate of the upper-left pixel.
width - The width of the image.
height - The height of the image.
tileGridXOffset - The X coordinate of the upper-left pixel of tile (0, 0).
tileGridYOffset - The Y coordinate of the upper-left pixel of tile (0, 0).
tileSampleModel - A SampleModel with which to be compatible.
colorModel - A ColorModel to associate with the image.

TiledImage

public TiledImage(Point origin,
                  SampleModel sampleModel,
                  int tileWidth,
                  int tileHeight)
Deprecated. as of JAI 1.1.

Constructs a TiledImage with a SampleModel that is compatible with a given SampleModel, and given tile dimensions. The width and height are taken from the SampleModel, and the image begins at a specified point. The ColorModel will be derived from the SampleModel using the createColorModel method of PlanarImage. Note that this implies that the ColorModel could be null.

Parameters:
origin - A Point indicating the image's upper left corner.
sampleModel - A SampleModel with which to be compatible.
tileWidth - The desired tile width.
tileHeight - The desired tile height.

TiledImage

public TiledImage(SampleModel sampleModel,
                  int tileWidth,
                  int tileHeight)
Deprecated. as of JAI 1.1.

Constructs a TiledImage starting at the global coordinate origin. The ColorModel will be derived from the SampleModel using the createColorModel method of PlanarImage. Note that this implies that the ColorModel could be null.

Parameters:
sampleModel - A SampleModel with which to be compatible.
tileWidth - The desired tile width.
tileHeight - The desired tile height.

TiledImage

public TiledImage(RenderedImage source,
                  int tileWidth,
                  int tileHeight)
Constructs a TiledImage equivalent to a given RenderedImage but with specific tile dimensions. Actual copying of the pixel data from the RenderedImage will be deferred until the first time they are requested from the TiledImage.

Parameters:
source - The source RenderedImage.
tileWidth - The desired tile width.
tileHeight - The desired tile height.
Since:
JAI 1.1

TiledImage

public TiledImage(RenderedImage source,
                  boolean areBuffersShared)
Constructs a TiledImage equivalent to a given RenderedImage. Actual copying of the pixel data from the RenderedImage will be deferred until the first time they are requested from the TiledImage. The tiles of the TiledImage may optionally share DataBuffers with the tiles of the source image but it should be realized in this case that data written into the TiledImage will be visible in the source image.

Parameters:
source - The source RenderedImage.
areBuffersShared - Whether the tile DataBuffers of the source are re-used in the tiles of this image. If false new WritableRasters will be created.
Since:
JAI 1.1
Method Detail

createInterleaved

public static TiledImage createInterleaved(int minX,
                                           int minY,
                                           int width,
                                           int height,
                                           int numBands,
                                           int dataType,
                                           int tileWidth,
                                           int tileHeight,
                                           int[] bandOffsets)
Deprecated. as of JAI 1.1.

Returns a TiledImage making use of an interleaved SampleModel with a given layout, number of bands, and data type. The ColorModel will be derived from the SampleModel using the createColorModel method of PlanarImage. Note that this implies that the ColorModel could be null.

Parameters:
minX - The X coordinate of the upper-left pixel
minY - The Y coordinate of the upper-left pixel.
width - The width of the image.
height - The height of the image.
numBands - The number of bands in the image.
dataType - The data type, from among the constants DataBuffer.TYPE_*.
tileWidth - The tile width.
tileHeight - The tile height.
bandOffsets - An array of non-duplicated integers between 0 and numBands - 1 of length numBands indicating the relative offset of each band.

createBanded

public static TiledImage createBanded(int minX,
                                      int minY,
                                      int width,
                                      int height,
                                      int dataType,
                                      int tileWidth,
                                      int tileHeight,
                                      int[] bankIndices,
                                      int[] bandOffsets)
Deprecated. as of JAI 1.1.

Returns a TiledImage making use of an banded SampleModel with a given layout, number of bands, and data type. The ColorModel will be derived from the SampleModel using the createColorModel method of PlanarImage. Note that this implies that the ColorModel could be null.

Parameters:
minX - The X coordinate of the upper-left pixel
minY - The Y coordinate of the upper-left pixel.
width - The width of the image.
height - The height of the image.
dataType - The data type, from among the constants DataBuffer.TYPE_*.
tileWidth - The tile width.
tileHeight - The tile height.
bankIndices - An array of ints indicating the index of the bank to use for each band. Bank indices may be duplicated.
bandOffsets - An array of integers indicating the starting offset of each band within its bank. Bands stored in the same bank must have sufficiently different offsets so as not to overlap.

set

public void set(RenderedImage im)
Overlays a given RenderedImage on top of the current contents of the TiledImage. The source image must have a SampleModel compatible with that of this image. If the source image does not overlap this image then invoking this method will have no effect.

The source image is added as a fallback PropertySource for the TiledImage: if a given property is not set directly on the TiledImage an attempt will be made to obtain its value from the source image.

Parameters:
im - A RenderedImage source to overlay.
Throws:
IllegalArgumentException - if im is null.

set

public void set(RenderedImage im,
                ROI roi)
Overlays a given RenderedImage on top of the current contents of the TiledImage and its intersection with the supplied ROI. The source image must have a SampleModel compatible with that of this image. If the source image and the region of interest do not both overlap this image then invoking this method will have no effect.

The source image is added as a fallback PropertySource for the TiledImage: if a given property is not set directly on the TiledImage an attempt will be made to obtain its value from the source image.

Parameters:
im - A RenderedImage source to overlay.
roi - The region of interest.
Throws:
IllegalArgumentException - either parameter is null.

getGraphics

public Graphics getGraphics()
Deprecated. as of JAI 1.1.

Creates a Graphics object that can be used to paint text and graphics onto the TiledImage. The TiledImage must be of integral data type or an UnsupportedOperationException will be thrown.

Overrides:
getGraphics in class PlanarImage

createGraphics

public Graphics2D createGraphics()
Creates a Graphics2D object that can be used to paint text and graphics onto the TiledImage. The TiledImage must be of integral data type or an UnsupportedOperationException will be thrown.


getSubImage

public TiledImage getSubImage(int x,
                              int y,
                              int w,
                              int h,
                              int[] bandSelect,
                              ColorModel cm)
Returns a TiledImage that shares the tile Rasters of this image. The returned image occupies a sub-area of the parent image, and possesses a possibly permuted subset of the parent's bands. The two images share a common coordinate system.

The image bounds are clipped against the bounds of the parent image.

If the specified ColorModel is null then the ColorModel of the sub-image will be set to null unless bandSelect is either null or equal in length to the number of bands in the image in which cases the sub-image ColorModel will be set to that of the current image.

Parameters:
x - the minimum X coordinate of the subimage.
y - the minimum Y coordinate of the subimage.
w - the width of the subimage.
h - the height of the subimage.
bandSelect - an array of band indices; if null, all bands are selected.
cm - the ColorModel of the sub-image.
Returns:
The requested sub-image or null if either the specified rectangular area or its intersection with the current image is empty.
Since:
JAI 1.1

getSubImage

public TiledImage getSubImage(int x,
                              int y,
                              int w,
                              int h,
                              int[] bandSelect)
Deprecated. as of JAI 1.1.

Returns a TiledImage that shares the tile Rasters of this image. The returned image occupies a sub-area of the parent image, and possesses a possibly permuted subset of the parent's bands. The two images share a common coordinate system. The ColorModel will be derived from the sub-image SampleModel using the createColorModel method of PlanarImage. Note that this implies that the ColorModel could be null.

The image bounds are clipped against the bounds of the parent image.

Parameters:
x - the minimum X coordinate of the subimage.
y - the minimum Y coordinate of the subimage.
w - the width of the subimage.
h - the height of the subimage.
bandSelect - an array of band indices; if null, all bands are selected.
Returns:
The requested sub-image or null if either the specified rectangular area or its intersection with the current image is empty.

getSubImage

public TiledImage getSubImage(int x,
                              int y,
                              int w,
                              int h)
Returns a TiledImage that shares the tile Rasters of this image. The returned image occupies a subarea of the parent image. The two images share a common coordinate system.

The image bounds are clipped against the bounds of the parent image.

Parameters:
x - the minimum X coordinate of the subimage.
y - the minimum Y coordinate of the subimage.
w - the width of the subimage.
h - the height of the subimage.

getSubImage

public TiledImage getSubImage(int[] bandSelect,
                              ColorModel cm)
Returns a TiledImage that shares the tile Rasters of this image.

If the specified ColorModel is null then the ColorModel of the sub-image will be set to null unless bandSelect is equal in length to the number of bands in the image in which cases the sub-image ColorModel will be set to that of the current image.

Parameters:
bandSelect - an array of band indices.
cm - the ColorModel of the sub-image.
Throws:
IllegalArgumentException - is bandSelect is null.
Since:
JAI 1.1

getSubImage

public TiledImage getSubImage(int[] bandSelect)
Deprecated. as of JAI 1.1.

Returns a TiledImage that shares the tile Rasters of this image. The returned image occupies the same area as the parent image, and possesses a possibly permuted subset of the parent's bands. The ColorModel will be derived from the sub-image SampleModel using the createColorModel method of PlanarImage. Note that this implies that the ColorModel could be null.

Parameters:
bandSelect - an array of band indices.

getTile

public Raster getTile(int tileX,
                      int tileY)
Retrieves a particular tile from the image for reading only. The tile will be computed if it hasn't been previously. Any attempt to write to the tile will produce undefined results.

Specified by:
getTile in interface RenderedImage
Specified by:
getTile in class PlanarImage
Parameters:
tileX - the X index of the tile.
tileY - the Y index of the tile.

getWritableTile

public WritableRaster getWritableTile(int tileX,
                                      int tileY)
Retrieves a particular tile from the image for reading and writing. If the tile is locked, null will be returned. Otherwise, the tile will be computed if it hasn't been previously. Updates of the tile will become visible to readers of this image as they occur.

Specified by:
getWritableTile in interface WritableRenderedImage
Parameters:
tileX - the X index of the tile.
tileY - the Y index of the tile.
Returns:
The requested tile or null if the tile is locked.

releaseWritableTile

public void releaseWritableTile(int tileX,
                                int tileY)
Indicates that a writer is done updating a tile. The effects of attempting to release a tile that has not been grabbed, or releasing a tile more than once are undefined.

Specified by:
releaseWritableTile in interface WritableRenderedImage
Parameters:
tileX - the X index of the tile.
tileY - the Y index of the tile.

lockTile

protected boolean lockTile(int tileX,
                           int tileY)
Forces a tile to be computed, and its contents stored indefinitely. A tile may not be locked if it is currently writable. This method should only be used within JAI, in order to optimize memory allocation.

Parameters:
tileX - the X index of the tile.
tileY - the Y index of the tile.
Returns:
Whether the tile was successfully locked.

isTileLocked

protected boolean isTileLocked(int tileX,
                               int tileY)
Returns true if a tile is locked.

Parameters:
tileX - the X index of the tile.
tileY - the Y index of the tile.
Returns:
Whether the tile is locked.

setData

public void setData(Raster r)
Sets a region of a TiledImage to be a copy of a supplied Raster. The Raster's coordinate system is used to position it within the image. The computation of all overlapping tiles will be forced prior to modification of the data of the affected area.

Specified by:
setData in interface WritableRenderedImage
Parameters:
r - a Raster containing pixels to be copied into the TiledImage.

setData

public void setData(Raster r,
                    ROI roi)
Sets a region of a TiledImage to be a copy of a supplied Raster. The Raster's coordinate system is used to position it within the image. The computation of all overlapping tiles will be forced prior to modification of the data of the affected area.

Parameters:
r - a Raster containing pixels to be copied into the TiledImage.
roi - The region of interest.

addTileObserver

public void addTileObserver(TileObserver observer)
Informs this TiledImage that another object is interested in being notified whenever any tile becomes writable or ceases to be writable. A tile becomes writable when it is not currently writable and getWritableTile() is called. A tile ceases to be writable when releaseTile() is called and the number of calls to getWritableTile() and releaseWritableTile() are identical.

It is the responsibility of the TiledImage to inform all registered TileObserver objects of such changes in tile writability before the writer has a chance to make any modifications.

Specified by:
addTileObserver in interface WritableRenderedImage
Parameters:
observer - An object implementing the TileObserver interface.

removeTileObserver

public void removeTileObserver(TileObserver observer)
Informs this TiledImage that a particular TileObserver no longer wishes to receive updates on tile writability status. The result of attempting to remove a listener that is not registered is undefined.

Specified by:
removeTileObserver in interface WritableRenderedImage
Parameters:
observer - An object implementing the TileObserver interface.

getWritableTileIndices

public Point[] getWritableTileIndices()
Returns a list of tiles that are currently held by one or more writers or null of no tiles are so held.

Specified by:
getWritableTileIndices in interface WritableRenderedImage
Returns:
An array of Points representing tile indices or null.

hasTileWriters

public boolean hasTileWriters()
Returns true if any tile is being held by a writer, false otherwise. This provides a quick way to check whether it is necessary to make copies of tiles -- if there are no writers, it is safe to use the tiles directly, while registering to learn of future writers.

Specified by:
hasTileWriters in interface WritableRenderedImage

isTileWritable

public boolean isTileWritable(int tileX,
                              int tileY)
Returns true if a tile has writers.

Specified by:
isTileWritable in interface WritableRenderedImage
Parameters:
tileX - the X index of the tile.
tileY - the Y index of the tile.

clearTiles

public void clearTiles()
Sets the tiles array to null so that the image may be used again.

Throws:
IllegalStateException - if hasTileWriters() returns true.
Since:
JAI 1.1.2

setSample

public void setSample(int x,
                      int y,
                      int b,
                      int s)
Sets a sample of a pixel to a given int value.

Parameters:
x - The X coordinate of the pixel.
y - The Y coordinate of the pixel.
b - The band of the sample within the pixel.
s - The value to which to set the sample.

getSample

public int getSample(int x,
                     int y,
                     int b)
Returns the value of a given sample of a pixel as an int.

Parameters:
x - The X coordinate of the pixel.
y - The Y coordinate of the pixel.
b - The band of the sample within the pixel.

setSample

public void setSample(int x,
                      int y,
                      int b,
                      float s)
Sets a sample of a pixel to a given float value.

Parameters:
x - The X coordinate of the pixel.
y - The Y coordinate of the pixel.
b - The band of the sample within the pixel.
s - The value to which to set the sample.

getSampleFloat

public float getSampleFloat(int x,
                            int y,
                            int b)
Returns the value of a given sample of a pixel as a float.

Parameters:
x - The X coordinate of the pixel.
y - The Y coordinate of the pixel.
b - The band of the sample within the pixel.

setSample

public void setSample(int x,
                      int y,
                      int b,
                      double s)
Sets a sample of a pixel to a given double value.

Parameters:
x - The X coordinate of the pixel.
y - The Y coordinate of the pixel.
b - The band of the sample within the pixel.
s - The value to which to set the sample.

getSampleDouble

public double getSampleDouble(int x,
                              int y,
                              int b)
Returns the value of a given sample of a pixel as a double.

Parameters:
x - The X coordinate of the pixel.
y - The Y coordinate of the pixel.
b - The band of the sample within the pixel.

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Implementation of PropertyChangeListener.

When invoked with an event emitted by the source image specified for this TiledImage and the event is either a PropertyChangeEventJAI named "InvalidRegion" (case-insensitive) or a RenderingChangeEvent, then all tiles which overlap the intersection of the invalid region and the region of interest specified for this image (if any) will be cleared. If the event is a RenderingChangeEvent then the invalid region will be obtained from the getInvalidRegion method of the event object; if a PropertyChangeEventJAI it will be obtained from the getNewValue() method. In either case, a new PropertyChangeEventJAI will be fired to all registered listeners of the property name "InvalidRegion" and to all known sinks which are PropertyChangeListeners. Its old and new values will contain the previous and current invalid regions. This may be used to determine which tiles must be re-requested. The TiledImage itself will not re-request the data.

Specified by:
propertyChange in interface PropertyChangeListener
Since:
JAI 1.1