Spec-Zone.ru › OpenJDK 25

Class AbstractMultiResolutionImage

java.lang.Object
java.awt.Image
java.awt.image.AbstractMultiResolutionImage
All Implemented Interfaces:
MultiResolutionImage
Direct Known Subclasses:
BaseMultiResolutionImage
public abstract class AbstractMultiResolutionImage extends Image implements MultiResolutionImage
This class provides default implementations of several Image methods for classes that want to implement the MultiResolutionImage interface. For example,
public class CustomMultiResolutionImage extends AbstractMultiResolutionImage {

    final Image[] resolutionVariants;

    public CustomMultiResolutionImage(Image... resolutionVariants) {
         this.resolutionVariants = resolutionVariants;
    }

    public Image getResolutionVariant(
            double destImageWidth, double destImageHeight) {
        // return a resolution variant based on the given destination image size
    }

    public List<Image> getResolutionVariants() {
        return Collections.unmodifiableList(Arrays.asList(resolutionVariants));
    }

    protected Image getBaseImage() {
        return resolutionVariants[0];
    }
}
 
Since:
9
See Also:
  • Image
  • MultiResolutionImage

Field Summary

Fields declared in class Image

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

Constructor Summary

AbstractMultiResolutionImage()
Modifier Constructor Description
protected
Constructor for subclasses to call.

Method Summary

Modifier and Type Method Description
protected abstract Image getBaseImage()
Return the base image representing the best version of the image for rendering at the default width and height.
Graphics getGraphics()
As per the contract of the base Image#getGraphics() method, this implementation will always throw UnsupportedOperationException since only off-screen images can return a Graphics object.
int getHeight(ImageObserver observer)
This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getHeight(observer).
Object getProperty(String name, ImageObserver observer)
This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getProperty(name, observer).
ImageProducer getSource()
This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getSource().
int getWidth(ImageObserver observer)
This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getWidth(observer).

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

Methods declared in interface MultiResolutionImage

getResolutionVariant, getResolutionVariants

Constructor Details

AbstractMultiResolutionImage

protected AbstractMultiResolutionImage()
Constructor for subclasses to call.

Method Details

getWidth

public int getWidth(ImageObserver observer)
This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getWidth(observer).
Specified by:
getWidth in class Image
Parameters:
observer - an object waiting for the image to be loaded.
Returns:
the width of the base image, or -1 if the width is not yet known
Since:
9
See Also:
  • getBaseImage()

getHeight

public int getHeight(ImageObserver observer)
This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getHeight(observer).
Specified by:
getHeight in class Image
Parameters:
observer - an object waiting for the image to be loaded.
Returns:
the height of the base image, or -1 if the height is not yet known
Since:
9
See Also:
  • getBaseImage()

getSource

public ImageProducer getSource()
This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getSource().
Specified by:
getSource in class Image
Returns:
the image producer that produces the pixels for the base image
Since:
9
See Also:
  • getBaseImage()

getGraphics

public Graphics getGraphics()
As per the contract of the base Image#getGraphics() method, this implementation will always throw UnsupportedOperationException since only off-screen images can return a Graphics object.
Specified by:
getGraphics in class Image
Returns:
throws UnsupportedOperationException
Throws:
UnsupportedOperationException - this method is not supported
See Also:
  • Graphics
  • Component.createImage(int, int)

getProperty

public Object getProperty(String name, ImageObserver observer)
This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getProperty(name, observer).
Specified by:
getProperty in class Image
Parameters:
name - a property name.
observer - an object waiting for this image to be loaded.
Returns:
the value of the named property in the base image
Since:
9
See Also:
  • getBaseImage()

getBaseImage

protected abstract Image getBaseImage()
Return the base image representing the best version of the image for rendering at the default width and height.
Returns:
the base image of the set of multi-resolution images
Since:
9

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/AbstractMultiResolutionImage.html

Spec-Zone.ru

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