MultiResolutionImage
public class BaseMultiResolutionImage extends AbstractMultiResolutionImage
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.
Image
,
MultiResolutionImage
,
AbstractMultiResolutionImage
accelerationPriority, SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty
Constructor | Description |
---|---|
BaseMultiResolutionImage(int baseImageIndex,
Image... resolutionVariants) |
Creates a multi-resolution image with the given base image index and
resolution variants.
|
BaseMultiResolutionImage(Image... resolutionVariants) |
Creates a multi-resolution image with the given resolution variants.
|
Modifier and Type | Method | Description |
---|---|---|
protected Image |
getBaseImage() |
Return the base image representing the best version of the image for
rendering at the default width and height.
|
Image |
getResolutionVariant(double destImageWidth,
double destImageHeight) |
Gets a specific image that is the best variant to represent
this logical image at the indicated size.
|
List<Image> |
getResolutionVariants() |
Gets a readable list of all resolution variants.
|
getGraphics, getHeight, getProperty, getSource, getWidth
flush, getAccelerationPriority, getCapabilities, getScaledInstance, setAccelerationPriority
public BaseMultiResolutionImage(Image... resolutionVariants)
resolutionVariants
- array of resolution variants sorted by image sizeIllegalArgumentException
- if null or zero-length array is passedNullPointerException
- if the specified resolutionVariants
contains one or more null elementspublic BaseMultiResolutionImage(int baseImageIndex, Image... resolutionVariants)
baseImageIndex
- the index of base image in the resolution variants
arrayresolutionVariants
- array of resolution variants sorted by image sizeIllegalArgumentException
- if null or zero-length array is passedNullPointerException
- if the specified resolutionVariants
contains one or more null elementsIndexOutOfBoundsException
- if baseImageIndex
is
negative or greater than or equal to resolutionVariants
length.public Image getResolutionVariant(double destImageWidth, double destImageHeight)
MultiResolutionImage
destImageWidth
- the width of the destination image, in pixels.destImageHeight
- the height of the destination image, in pixels.public List<Image> getResolutionVariants()
MultiResolutionImage
Note that many implementations might return an unmodifiable list.
protected Image getBaseImage()
AbstractMultiResolutionImage
getBaseImage
in class AbstractMultiResolutionImage
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-internal+0-adhoc.mlchung.jdk9-jdeps