Spec-Zone.ru › OpenJDK 25

Class BaseMultiResolutionImage

java.lang.Object
java.awt.Image
java.awt.image.AbstractMultiResolutionImage
java.awt.image.BaseMultiResolutionImage
All Implemented Interfaces:
MultiResolutionImage
public class BaseMultiResolutionImage extends AbstractMultiResolutionImage
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:
  • Image
  • MultiResolutionImage
  • AbstractMultiResolutionImage

Field Summary

Fields declared in class Image

accelerationPriority, SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty

Constructor Summary

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.

Method Summary

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.

Methods declared in class AbstractMultiResolutionImage

getGraphics, getHeight, getProperty, getSource, getWidth

Methods declared in class Image

flush, getAccelerationPriority, getCapabilities, getScaledInstance, setAccelerationPriority

Methods declared in class Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

BaseMultiResolutionImage

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 - array of resolution variants sorted by image size
Throws:
IllegalArgumentException - if null or zero-length array is passed
NullPointerException - if the specified resolutionVariants contains one or more null elements
Since:
9

BaseMultiResolutionImage

public BaseMultiResolutionImage(int baseImageIndex, Image... resolutionVariants)
Creates a multi-resolution image with the given base image index and resolution variants.
Parameters:
baseImageIndex - the index of base image in the resolution variants array
resolutionVariants - array of resolution variants sorted by image size
Throws:
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 Details

getResolutionVariant

public Image getResolutionVariant(double destImageWidth, double destImageHeight)
Description copied from interface: MultiResolutionImage
Gets a specific image that is the best variant to represent this logical image at the indicated size.
Parameters:
destImageWidth - the width of the destination image, in pixels.
destImageHeight - the height of the destination image, in pixels.
Returns:
image resolution variant.

getResolutionVariants

public List<Image> getResolutionVariants()
Description copied from interface: MultiResolutionImage
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.

Returns:
list of resolution variants.

getBaseImage

protected Image getBaseImage()
Description copied from class: AbstractMultiResolutionImage
Return the base image representing the best version of the image for rendering at the default width and height.
Specified by:
getBaseImage in class AbstractMultiResolutionImage
Returns:
the base image of the set of multi-resolution images

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2025, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.desktop/java/awt/image/BaseMultiResolutionImage.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API