-
- All Superinterfaces:
- RenderedImage
- All Known Implementing Classes:
- BufferedImage
public interface WritableRenderedImage extends RenderedImage
WriteableRenderedImage is a common interface for objects which contain or can produce image data in the form of Rasters and which can be modified and/or written over. The image data may be stored/produced as a single tile or a regular array of tiles.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
Methods Modifier and Type Method and Description void
addTileObserver(TileObserver to)
Adds an observer.WritableRaster
getWritableTile(int tileX, int tileY)
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(int tileX, int tileY)
Returns whether a tile is currently checked out for writing.void
releaseWritableTile(int tileX, int tileY)
Relinquishes the right to write to a tile.void
removeTileObserver(TileObserver to)
Removes an observer.void
setData(Raster r)
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 inherited from interface java.awt.image.RenderedImage
copyData, getColorModel, getData, getData, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getProperty, getPropertyNames, getSampleModel, getSources, getTile, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidth
-
-
-
-
Method Detail
-
addTileObserver
void addTileObserver(TileObserver to)
Adds an observer. If the observer is already present, it will receive multiple notifications.- Parameters:
to
- the specifiedTileObserver
-
removeTileObserver
void removeTileObserver(TileObserver to)
Removes an observer. If the observer was not registered, nothing happens. If the observer was registered for multiple notifications, it will now be registered for one fewer.- Parameters:
to
- the specifiedTileObserver
-
getWritableTile
WritableRaster getWritableTile(int tileX, int tileY)
Checks out a tile for writing. The WritableRenderedImage is responsible for notifying all of its TileObservers when a tile goes from having no writers to having one writer.- 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)
Relinquishes the right to write to a tile. If the caller continues to write to the tile, the results are undefined. Calls to this method should only appear in matching pairs with calls to getWritableTile; any other use will lead to undefined results. The WritableRenderedImage is responsible for notifying all of its TileObservers when a tile goes from having one writer to having no writers.- Parameters:
tileX
- the X index of the tile.tileY
- the Y index of the tile.
-
isTileWritable
boolean isTileWritable(int tileX, int tileY)
Returns whether a tile is currently checked out for writing.- Parameters:
tileX
- the X index of the tile.tileY
- the Y index of the tile.- Returns:
true
if specified tile is checked out for writing;false
otherwise.
-
getWritableTileIndices
Point[] getWritableTileIndices()
Returns an array of Point objects indicating which tiles are checked out for writing. Returns null if none are checked out.- Returns:
- an array containing the locations of tiles that are checked out for writing.
-
hasTileWriters
boolean hasTileWriters()
Returns whether any tile is checked out for writing. Semantically equivalent to (getWritableTileIndices() != null).- Returns:
true
if any tiles are checked out for writing;false
otherwise.
-
setData
void setData(Raster r)
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. The operation is clipped to the bounds of the WritableRenderedImage.- Parameters:
r
- the specifiedRaster
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-java/awt/image/WritableRenderedImage.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.