Package com.bc.ceres.glevel.support
Class DefaultMultiLevelSource
- java.lang.Object
-
- com.bc.ceres.glevel.support.AbstractMultiLevelSource
-
- com.bc.ceres.glevel.support.DefaultMultiLevelSource
-
- All Implemented Interfaces:
MultiLevelSource
public class DefaultMultiLevelSource extends AbstractMultiLevelSource
A default implementation for theMultiLevelSource
interface.
-
-
Field Summary
Fields Modifier and Type Field Description static javax.media.jai.Interpolation
DEFAULT_INTERPOLATION
Default interpolation is "Nearest Neighbour".static MultiLevelSource
NULL
-
Constructor Summary
Constructors Constructor Description DefaultMultiLevelSource(RenderedImage sourceImage, int levelCount)
Constructs a new instance withDEFAULT_INTERPOLATION
.DefaultMultiLevelSource(RenderedImage sourceImage, int levelCount, javax.media.jai.Interpolation interpolation)
Constructs a new instance.DefaultMultiLevelSource(RenderedImage sourceImage, MultiLevelModel multiLevelModel)
Constructs a new instance withDEFAULT_INTERPOLATION
.DefaultMultiLevelSource(RenderedImage sourceImage, MultiLevelModel multiLevelModel, javax.media.jai.Interpolation interpolation)
Constructs a new instance withDEFAULT_INTERPOLATION
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MultiLevelModel
createDefaultMultiLevelModel(RenderedImage sourceImage, int levelCount)
protected RenderedImage
createImage(int level)
Creates a scaled version of the level-0 image for the given level.RenderedImage
getImage(int level)
Returns the level-0 image iflevel
equals zero, otherwise callssuper.getLevelImage(level)
.javax.media.jai.Interpolation
getInterpolation()
static Rectangle
getLevelImageBounds(Rectangle sourceBounds, double scale)
Computes the boundaries of an image at a given resolution scaling from the given source image boundaries (at level zero).RenderedImage
getSourceImage()
void
reset()
Removes all cached level images and also disposes anyPlanarImage
s among them.-
Methods inherited from class com.bc.ceres.glevel.support.AbstractMultiLevelSource
checkLevel, getImageShape, getModel
-
-
-
-
Field Detail
-
DEFAULT_INTERPOLATION
public static final javax.media.jai.Interpolation DEFAULT_INTERPOLATION
Default interpolation is "Nearest Neighbour".
-
NULL
public static final MultiLevelSource NULL
-
-
Constructor Detail
-
DefaultMultiLevelSource
public DefaultMultiLevelSource(RenderedImage sourceImage, int levelCount)
Constructs a new instance withDEFAULT_INTERPOLATION
.- Parameters:
sourceImage
- The source image.levelCount
- The level count.
-
DefaultMultiLevelSource
public DefaultMultiLevelSource(RenderedImage sourceImage, int levelCount, javax.media.jai.Interpolation interpolation)
Constructs a new instance.- Parameters:
sourceImage
- The source image.levelCount
- The level count.interpolation
- The interpolation.
-
DefaultMultiLevelSource
public DefaultMultiLevelSource(RenderedImage sourceImage, MultiLevelModel multiLevelModel)
Constructs a new instance withDEFAULT_INTERPOLATION
.- Parameters:
sourceImage
- The source image.multiLevelModel
- The multi level model.
-
DefaultMultiLevelSource
public DefaultMultiLevelSource(RenderedImage sourceImage, MultiLevelModel multiLevelModel, javax.media.jai.Interpolation interpolation)
Constructs a new instance withDEFAULT_INTERPOLATION
.- Parameters:
sourceImage
- The source image.multiLevelModel
- The multi level model.interpolation
- The interpolation.
-
-
Method Detail
-
getSourceImage
public RenderedImage getSourceImage()
-
getInterpolation
public javax.media.jai.Interpolation getInterpolation()
-
getImage
public RenderedImage getImage(int level)
Returns the level-0 image iflevel
equals zero, otherwise callssuper.getLevelImage(level)
. This override prevents the base class from storing a reference to the source image (the level-0 image). SeeAbstractMultiLevelSource.createImage(int)
.- Specified by:
getImage
in interfaceMultiLevelSource
- Overrides:
getImage
in classAbstractMultiLevelSource
- Parameters:
level
- The level.- Returns:
- The image.
-
createImage
protected RenderedImage createImage(int level)
Creates a scaled version of the level-0 image for the given level. SeegetImage(int)
andsuper.createImage(int)
.- Specified by:
createImage
in classAbstractMultiLevelSource
- Parameters:
level
- The level.- Returns:
- The image.
-
reset
public void reset()
Description copied from class:AbstractMultiLevelSource
Removes all cached level images and also disposes anyPlanarImage
s among them.Overrides should always call
super.reset()
.- Specified by:
reset
in interfaceMultiLevelSource
- Overrides:
reset
in classAbstractMultiLevelSource
-
createDefaultMultiLevelModel
public static MultiLevelModel createDefaultMultiLevelModel(RenderedImage sourceImage, int levelCount)
-
getLevelImageBounds
public static Rectangle getLevelImageBounds(Rectangle sourceBounds, double scale)
Computes the boundaries of an image at a given resolution scaling from the given source image boundaries (at level zero).- Parameters:
sourceBounds
- The image boundaries of the level zero image.scale
- The scale at a given level as returned byMultiLevelModel.getScale(int)
.- Returns:
- The level image boundaries in pixel coordinates.
- Since:
- BEAM 5
-
-