Class RenderedImageAdapter
- All Implemented Interfaces:
RenderedImage,ImageImageN,PropertyChangeEmitter,PropertySource,WritablePropertySource
- Direct Known Subclasses:
AttributedImage,WritableRenderedImageAdapter
PlanarImage wrapper for a non-writable RenderedImage. The tile layout, sample model, and
so forth are preserved. Calls to getTile(), getData(), and copyData() are
forwarded to the image being adapted.
The set of properties available on the image will be a combination of those defined locally via
setProperty() and those defined on the source image with the local properties taking precedence. No
PropertySourceChangeEvent will be generated as a result of changes to the property set of the source image.
From ImageN's point of view, this image is a PlanarImage of unknown type, with no sources. The source
image is assumed to be immutable. If the RenderedImage source implements WritableRenderedImage
, a WritableRenderedImageAdapter should be used.
The methods are marked 'final' in order to allow dynamic inlining to take place. This should eliminate any performance penalty associated with the use of an adapter class.
Since the methods of this class all derive from PlanarImage, they are not commented in detail.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal WritableRastercopyData(WritableRaster raster) Forwards call to the true source.final RastergetData()Forwards call to the true source.final RasterForwards call to the true source.final ObjectgetProperty(String name) Retrieves the property from those set locally on the image or, if the property is not available locally, the call is forwarded to the true source.final ClassgetPropertyClass(String name) Returns the class expected to be returned by a request for the property with the specified name.final String[]Retrieves a list of property names recognized by this image.final RastergetTile(int x, int y) Forwards call to the true source unless the specified tile indices refer to a tile which does not overlap the image bounds in which casenullis returned.final RenderedImageReturns the reference to the externalRenderedImageoriginally supplied to the constructor.Methods inherited from class PlanarImage
addPropertyChangeListener, addPropertyChangeListener, addSink, addTileComputationListener, cancelTiles, copyData, copyExtendedData, createColorModel, createSnapshot, dispose, getAsBufferedImage, getAsBufferedImage, getBounds, getColorModel, getDefaultColorModel, getExtendedData, getGraphics, getHeight, getImageID, getMaxTileX, getMaxTileY, getMaxX, getMaxY, getMinTileX, getMinTileY, getMinX, getMinY, getNumBands, getNumSources, getNumXTiles, getNumYTiles, 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, removeSinks, removeTileComputationListener, setProperty, tileXToX, tileXToX, tileYToY, tileYToY, toString, wrapRenderedImage, XToTileX, XToTileX, YToTileY, YToTileY
-
Constructor Details
-
RenderedImageAdapter
Constructs a RenderedImageAdapter.- Parameters:
im- a RenderedImage to be `wrapped' as a PlanarImage.- Throws:
IllegalArgumentException- ifimisnull.
-
-
Method Details
-
getWrappedImage
Returns the reference to the externalRenderedImageoriginally supplied to the constructor. -
getTile
Forwards call to the true source unless the specified tile indices refer to a tile which does not overlap the image bounds in which casenullis returned.- Specified by:
getTilein interfaceRenderedImage- Specified by:
getTilein classPlanarImage- Parameters:
x- The X index of the requested tile in the tile array.y- The Y index of the requested tile in the tile array.
-
getData
Forwards call to the true source.- Specified by:
getDatain interfaceRenderedImage- Overrides:
getDatain classPlanarImage- Returns:
- A
Rastercontaining the entire image data.
-
getData
Forwards call to the true source.- Specified by:
getDatain interfaceRenderedImage- Overrides:
getDatain classPlanarImage- Parameters:
rect- The rectangular region of this image to be returned, ornull.- Returns:
- A
Rastercontaining the specified image data.
-
copyData
Forwards call to the true source.- Specified by:
copyDatain interfaceRenderedImage- Overrides:
copyDatain classPlanarImage- Parameters:
raster- AWritableRasterto hold the copied pixel data of this image.- Returns:
- A reference to the supplied
WritableRaster, or to a newWritableRasterif the supplied one wasnull.
-
getPropertyNames
Retrieves a list of property names recognized by this image. The locally defined property names are combined with those derived from the true source.- Specified by:
getPropertyNamesin interfacePropertySource- Specified by:
getPropertyNamesin interfaceRenderedImage- Overrides:
getPropertyNamesin classPlanarImage- Returns:
- an array of
Strings containing valid property names ornull.
-
getProperty
Retrieves the property from those set locally on the image or, if the property is not available locally, the call is forwarded to the true source.- Specified by:
getPropertyin interfacePropertySource- Specified by:
getPropertyin interfaceRenderedImage- Overrides:
getPropertyin classPlanarImage- Parameters:
name- the name of the property to get, as aString.- Returns:
- A reference to the property
Object, or the valuejava.awt.Image.UndefinedProperty. - Throws:
IllegalArgumentException- ifnameisnull.
-
getPropertyClass
Returns the class expected to be returned by a request for the property with the specified name. If this information is unavailable,nullwill be returned.- Specified by:
getPropertyClassin interfacePropertySource- Overrides:
getPropertyClassin classPlanarImage- Parameters:
name- the name of the property, as aString.- Returns:
- The
Classexpected to be return by a request for the value of this property ornull. - Throws:
IllegalArgumentException- ifnameisnull.
-