- All Implemented Interfaces:
AbstractMultiResolutionImageclass. 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.
Method SummaryModifier and TypeMethodDescription
()Return the base image representing the best version of the image for rendering at the default width and height.
(double destImageWidth, double destImageHeight)Gets a specific image that is the best variant to represent this logical image at the indicated size.
()Gets a readable list of all resolution variants.
Methods declared in class java.awt.image.AbstractMultiResolutionImage
getGraphics, getHeight, getProperty, getSource, getWidth
Methods declared in class java.awt.Image
flush, getAccelerationPriority, getCapabilities, getScaledInstance, setAccelerationPriority
BaseMultiResolutionImagepublic BaseMultiResolutionImage(Image... resolutionVariants)Creates a multi-resolution image with the given resolution variants. The first resolution variant is used as the base image.
BaseMultiResolutionImagepublic BaseMultiResolutionImage(int baseImageIndex, Image... resolutionVariants)Creates a multi-resolution image with the given base image index and resolution variants.
baseImageIndex- the index of base image in the resolution variants array
resolutionVariants- array of resolution variants sorted by image size
IllegalArgumentException- if null or zero-length array is passed
NullPointerException- if the specified
resolutionVariantscontains one or more null elements
baseImageIndexis negative or greater than or equal to
getResolutionVariantpublic Image getResolutionVariant(double destImageWidth, double destImageHeight)Description copied from interface:
MultiResolutionImageGets a specific image that is the best variant to represent this logical image at the indicated size.
destImageWidth- the width of the destination image, in pixels.
destImageHeight- the height of the destination image, in pixels.
- image resolution variant.
getResolutionVariantsDescription copied from interface:
MultiResolutionImageGets 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.
- list of resolution variants.
getBaseImageprotected Image getBaseImage()Description copied from class:
AbstractMultiResolutionImageReturn the base image representing the best version of the image for rendering at the default width and height.