Package com.bc.ceres.glevel.support
Class DefaultMultiLevelImage
- java.lang.Object
-
- javax.media.jai.PlanarImage
-
- com.bc.ceres.glevel.MultiLevelImage
-
- com.bc.ceres.glevel.support.DefaultMultiLevelImage
-
- All Implemented Interfaces:
MultiLevelSource
,RenderedImage
,javax.media.jai.ImageJAI
,javax.media.jai.PropertyChangeEmitter
,javax.media.jai.PropertySource
,javax.media.jai.WritablePropertySource
public class DefaultMultiLevelImage extends MultiLevelImage
Adapts a JAIPlanarImage
to theMultiLevelSource
interface. The image data provided by thisPlanarImage
corresponds to the level zero image of the givenMultiLevelSource
.
-
-
Field Summary
-
Fields inherited from class javax.media.jai.PlanarImage
colorModel, eventManager, height, minX, minY, properties, sampleModel, tileFactory, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width
-
Fields inherited from interface com.bc.ceres.glevel.MultiLevelSource
NULL
-
-
Constructor Summary
Constructors Constructor Description DefaultMultiLevelImage(MultiLevelSource source)
Constructs a new multi-level image from the given source.DefaultMultiLevelImage(MultiLevelSource source, javax.media.jai.ImageLayout layout)
Constructs a new multi-level image from the given source and the image layout.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Provides a hint that an image will no longer be accessed from a reference in user space.RenderedImage
getImage(int level)
Gets the scaled image for the given resolution level.Shape
getImageShape(int level)
Gets the shape of the area where this image's raster data contains valid pixels at the given resolution level.MultiLevelModel
getModel()
Gets the layout model for the multi-resolution image supported by thisLevelImageSource
.MultiLevelSource
getSource()
void
reset()
Provides a hint that the level images provided so far will no longer be accessed from a reference in user space.-
Methods inherited from class com.bc.ceres.glevel.MultiLevelImage
copyData, getData, getData, getTile
-
Methods inherited from class javax.media.jai.PlanarImage
addPropertyChangeListener, addPropertyChangeListener, addSink, addSink, addSource, addTileComputationListener, cancelTiles, copyData, copyExtendedData, createColorModel, createSnapshot, createWritableRaster, finalize, getAsBufferedImage, getAsBufferedImage, getBounds, getColorModel, getDefaultColorModel, getExtendedData, getGraphics, 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
-
-
-
-
Constructor Detail
-
DefaultMultiLevelImage
public DefaultMultiLevelImage(MultiLevelSource source)
Constructs a new multi-level image from the given source.- Parameters:
source
- The multi-level image source.
-
DefaultMultiLevelImage
public DefaultMultiLevelImage(MultiLevelSource source, javax.media.jai.ImageLayout layout)
Constructs a new multi-level image from the given source and the image layout.- Parameters:
source
- The multi-level image source.layout
- The image layout.
-
-
Method Detail
-
getSource
public final MultiLevelSource getSource()
- Returns:
- The multi-level image source.
-
getModel
public final MultiLevelModel getModel()
Description copied from interface:MultiLevelSource
Gets the layout model for the multi-resolution image supported by thisLevelImageSource
.- Returns:
- the multi-resolution image model.
-
getImage
public final RenderedImage getImage(int level)
Description copied from interface:MultiLevelSource
Gets the scaled image for the given resolution level. The width and height of an image returned for a givenlevel
isscale
times smaller than the dimensions of the image atlevel=0
.- Parameters:
level
- The resolution level.- Returns:
- The scaled image, must be in the range 0 to
MultiLevelModel.getLevelCount()
-1.
-
getImageShape
public Shape getImageShape(int level)
Description copied from interface:MultiLevelSource
Gets the shape of the area where this image's raster data contains valid pixels at the given resolution level. The method returnsnull
, if the entire image raster contains valid pixels.- Parameters:
level
- The resolution level.- Returns:
- The shape of the area where the image has data, can be
null
.
-
reset
public void reset()
Description copied from interface:MultiLevelSource
Provides a hint that the level images provided so far will no longer be accessed from a reference in user space.
Therefore implementations of this method might also dispose any cached level images that have been provided so far.
After calling this method, a call to
MultiLevelSource.getImage(int)
} for the same level may return a new level image instance.This method is particularly useful if properties have changed that affect the appearance of the returned images at all levels, e.g. after a new color palette has been assigned or the contrast range has changed.
-
dispose
public void dispose()
Description copied from class:MultiLevelImage
Provides a hint that an image will no longer be accessed from a reference in user space. The results are equivalent to those that occur when the program loses its last reference to this image, the garbage collector discovers this, and finalize is called. This can be used as a hint in situations where waiting for garbage collection would be overly conservative.The results of referencing an image after a call to
dispose()
are undefined.Overrides shall call
super.dispose()
in a final step.- Overrides:
dispose
in classMultiLevelImage
-
-