Interface WritableRenderedImage
- All Superinterfaces:
RenderedImage
- All Known Implementing Classes:
BufferedImage
public interface WritableRenderedImage extends RenderedImage
WritableRenderedImage provides notification to other interested objects when a tile is checked out for writing (via the getWritableTile method) and when the last writer of a particular tile relinquishes its access (via a call to releaseWritableTile). Additionally, it allows any caller to determine whether any tiles are currently checked out (via hasTileWriters), and to obtain a list of such tiles (via getWritableTileIndices, in the form of a Vector of Point objects).
Objects wishing to be notified of changes in tile writability must implement the TileObserver interface, and are added by a call to addTileObserver. Multiple calls to addTileObserver for the same object will result in multiple notifications. An existing observer may reduce its notifications by calling removeTileObserver; if the observer had no notifications the operation is a no-op.
It is necessary for a WritableRenderedImage to ensure that notifications occur only when the first writer acquires a tile and the last writer releases it.
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
void |
addTileObserver |
Adds an observer. |
WritableRaster |
getWritableTile |
Checks out a tile for writing. |
Point[] |
getWritableTileIndices() |
Returns an array of Point objects indicating which tiles are checked out for writing. |
boolean |
hasTileWriters() |
Returns whether any tile is checked out for writing. |
boolean |
isTileWritable |
Returns whether a tile is currently checked out for writing. |
void |
releaseWritableTile |
Relinquishes the right to write to a tile. |
void |
removeTileObserver |
Removes an observer. |
void |
setData |
Sets a rect of the image to the contents of the Raster r, which is assumed to be in the same coordinate space as the WritableRenderedImage. |
Methods declared in interface RenderedImage
copyData, getColorModel, getData, getData, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getProperty, getPropertyNames, getSampleModel, getSources, getTile, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidth | Modifier and Type | Method | Description |
|---|---|---|
WritableRaster |
copyData |
Computes an arbitrary rectangular region of the RenderedImage and copies it into a caller-supplied WritableRaster. |
ColorModel |
getColorModel() |
Returns the ColorModel associated with this image. |
Raster |
getData() |
Returns the image as one large tile (for tile based images this will require fetching the whole image and copying the image data over). |
Raster |
getData |
Computes and returns an arbitrary region of the RenderedImage. |
int |
getHeight() |
Returns the height of the RenderedImage. |
int |
getMinTileX() |
Returns the minimum tile index in the X direction. |
int |
getMinTileY() |
Returns the minimum tile index in the Y direction. |
int |
getMinX() |
Returns the minimum X coordinate (inclusive) of the RenderedImage. |
int |
getMinY() |
Returns the minimum Y coordinate (inclusive) of the RenderedImage. |
int |
getNumXTiles() |
Returns the number of tiles in the X direction. |
int |
getNumYTiles() |
Returns the number of tiles in the Y direction. |
Object |
getProperty |
Gets a property from the property set of this image. |
String[] |
getPropertyNames() |
Returns an array of names recognized by getProperty(String) or null, if no property names are recognized. |
SampleModel |
getSampleModel() |
Returns the SampleModel associated with this image. |
Vector |
getSources() |
Returns a vector of RenderedImages that are the immediate sources of image data for this RenderedImage. |
Raster |
getTile |
Returns tile (tileX, tileY). |
int |
getTileGridXOffset() |
Returns the X offset of the tile grid relative to the origin, i.e., the X coordinate of the upper-left pixel of tile (0, 0). |
int |
getTileGridYOffset() |
Returns the Y offset of the tile grid relative to the origin, i.e., the Y coordinate of the upper-left pixel of tile (0, 0). |
int |
getTileHeight() |
Returns the tile height in pixels. |
int |
getTileWidth() |
Returns the tile width in pixels. |
int |
getWidth() |
Returns the width of the RenderedImage. |
Method Details
addTileObserver
void addTileObserver(TileObserver to)
- Parameters:
-
to- the specifiedTileObserver
removeTileObserver
void removeTileObserver(TileObserver to)
- Parameters:
-
to- the specifiedTileObserver
getWritableTile
WritableRaster getWritableTile(int tileX, int tileY)
- Parameters:
-
tileX- the X index of the tile. -
tileY- the Y index of the tile. - Returns:
- a writable tile.
releaseWritableTile
void releaseWritableTile(int tileX, int tileY)
- Parameters:
-
tileX- the X index of the tile. -
tileY- the Y index of the tile.
isTileWritable
boolean isTileWritable(int tileX, int tileY)
- Parameters:
-
tileX- the X index of the tile. -
tileY- the Y index of the tile. - Returns:
-
trueif specified tile is checked out for writing;falseotherwise.
getWritableTileIndices
Point[] getWritableTileIndices()
- Returns:
- an array containing the locations of tiles that are checked out for writing.
hasTileWriters
boolean hasTileWriters()
- Returns:
-
trueif any tiles are checked out for writing;falseotherwise.
setData
void setData(Raster r)
- Parameters:
-
r- the specifiedRaster
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.