AbstractMultiResolutionImage class.
This class will implement the
getResolutionVariant(double destImageWidth, double destImageHeight)
method using a simple algorithm which will return the first image variant
in the array that is large enough to satisfy the rendering request. The
last image in the array will be returned if no suitable image is found
that is as large as the rendering request.
For best effect the array of images should be sorted with each image being both wider and taller than the previous image. The base image need not be the first image in the array. No exception will be thrown if the images are not sorted as suggested.
java.awt.Image , java.awt.image.MultiResolutionImage , java.awt.image.AbstractMultiResolutionImage
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final Image[] |
| Access | Constructor and Description |
|---|---|
| public | BaseMultiResolutionImage(Image...
array of resolution variants sorted by image size resolutionVariants)Creates a multi-resolution image with the given resolution variants. |
| public | BaseMultiResolutionImage(int
the index of base image in the resolution variants
array baseImageIndex, Image... array of resolution variants sorted by image size resolutionVariants)Creates a multi-resolution image with the given base image index and resolution variants. |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| protected Image | getBaseImage()
Implements abstract java. Return the base image representing the best version of the image for rendering at the default width and height. |
| public Image | getResolutionVariant(double destImageWidth, double destImageHeight)
Implements java. Gets a specific image that is the best variant to represent this logical image at the indicated size. |
| public List | getResolutionVariants()
Implements java. Gets a readable list of all resolution variants. |
| baseImageIndex | back to summary |
|---|---|
| private final int baseImageIndex | |
| resolutionVariants | back to summary |
|---|---|
| private final Image[] resolutionVariants | |
| BaseMultiResolutionImage | back to summary |
|---|---|
| public BaseMultiResolutionImage(Image... resolutionVariants) Creates a multi-resolution image with the given resolution variants. The first resolution variant is used as the base image.
| |
| BaseMultiResolutionImage | back to summary |
|---|---|
| public BaseMultiResolutionImage(int baseImageIndex, Image... resolutionVariants) Creates a multi-resolution image with the given base image index and resolution variants.
| |
| checkSize | back to summary |
|---|---|
| private static void checkSize(double width, double height) | |
| getBaseImage | back to summary |
|---|---|
| protected Image getBaseImage() Implements abstract java. Doc from java. Return the base image representing the best version of the image for rendering at the default width and height.
| |
| getResolutionVariant | back to summary |
|---|---|
| public Image getResolutionVariant(double destImageWidth, double destImageHeight) Implements java. Doc from java. Gets a specific image that is the best variant to represent this logical image at the indicated size.
| |
| getResolutionVariants | back to summary |
|---|---|
| public List Implements java. Doc from java. Gets a readable list of all resolution variants. The list must be nonempty and contain at least one resolution variant. Note that many implementations might return an unmodifiable list.
| |