APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt.image

public Class BaseMultiResolutionImage

extends AbstractMultiResolutionImage
Class Inheritance
Imports
java.awt.Image, java.util.List, .Arrays, .Collections, .Objects

This class is an array-based implementation of the 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.

Since
9
See Also
java.awt.Image, java.awt.image.MultiResolutionImage, java.awt.image.AbstractMultiResolutionImage

Field Summary

Modifier and TypeField and Description
private final int
private final Image[]

Constructor Summary

AccessConstructor 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.

Method Summary

Modifier and TypeMethod and Description
private static void
checkSize(double width, double height)

protected Image
getBaseImage()

Implements abstract java.awt.image.AbstractMultiResolutionImage.getBaseImage.

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.awt.image.MultiResolutionImage.getResolutionVariant.

Gets a specific image that is the best variant to represent this logical image at the indicated size.

public List<Image>
getResolutionVariants()

Implements java.awt.image.MultiResolutionImage.getResolutionVariants.

Gets a readable list of all resolution variants.

Inherited from java.awt.image.AbstractMultiResolutionImage:
getGraphicsgetHeightgetPropertygetSourcegetWidth

Field Detail

baseImageIndexback to summary
private final int baseImageIndex
resolutionVariantsback to summary
private final Image[] resolutionVariants

Constructor Detail

BaseMultiResolutionImageback 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.

Parameters
resolutionVariants:Image[]

array of resolution variants sorted by image size

Exceptions
IllegalArgumentException:
if null or zero-length array is passed
NullPointerException:
if the specified resolutionVariants contains one or more null elements
Since
9
BaseMultiResolutionImageback to summary
public BaseMultiResolutionImage(int baseImageIndex, Image... resolutionVariants)

Creates a multi-resolution image with the given base image index and resolution variants.

Parameters
baseImageIndex:int

the index of base image in the resolution variants array

resolutionVariants:Image[]

array of resolution variants sorted by image size

Exceptions
IllegalArgumentException:
if null or zero-length array is passed
NullPointerException:
if the specified resolutionVariants contains one or more null elements
IndexOutOfBoundsException:
if baseImageIndex is negative or greater than or equal to resolutionVariants length.
Since
9

Method Detail

checkSizeback to summary
private static void checkSize(double width, double height)
getBaseImageback to summary
protected Image getBaseImage()

Implements abstract java.awt.image.AbstractMultiResolutionImage.getBaseImage.

Doc from java.awt.image.AbstractMultiResolutionImage.getBaseImage.

Return the base image representing the best version of the image for rendering at the default width and height.

Annotations
@Override
getResolutionVariantback to summary
public Image getResolutionVariant(double destImageWidth, double destImageHeight)

Implements java.awt.image.MultiResolutionImage.getResolutionVariant.

Doc from java.awt.image.MultiResolutionImage.getResolutionVariant.

Gets a specific image that is the best variant to represent this logical image at the indicated size.

Annotations
@Override
getResolutionVariantsback to summary
public List<Image> getResolutionVariants()

Implements java.awt.image.MultiResolutionImage.getResolutionVariants.

Doc from java.awt.image.MultiResolutionImage.getResolutionVariants.

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.

Annotations
@Override