MultiResolutionImage
BaseMultiResolutionImage
public abstract class AbstractMultiResolutionImage extends Image implements MultiResolutionImage
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];
}
}
accelerationPriority, SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty
Modifier | Constructor | Description |
---|---|---|
protected |
Constructor for subclasses to call. |
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 |
This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getHeight(observer) . |
Object |
getProperty |
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 |
This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getWidth(observer) . |
flush, getAccelerationPriority, getCapabilities, getScaledInstance, setAccelerationPriority
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getResolutionVariant, getResolutionVariants
protected AbstractMultiResolutionImage()
public int getWidth(ImageObserver observer)
getBaseImage().getWidth(observer)
.public int getHeight(ImageObserver observer)
getBaseImage().getHeight(observer)
.public ImageProducer getSource()
getBaseImage().getSource()
.public Graphics getGraphics()
Image#getGraphics()
method, this implementation will always throw UnsupportedOperationException
since only off-screen images can return a Graphics
object.getGraphics
in class Image
UnsupportedOperationException
UnsupportedOperationException
- this method is not supportedpublic Object getProperty(String name, ImageObserver observer)
getBaseImage().getProperty(name, observer)
.getProperty
in class Image
name
- a property name.observer
- an object waiting for this image to be loaded.protected abstract Image getBaseImage()
© 1993, 2023, 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/21/docs/api/java.desktop/java/awt/image/AbstractMultiResolutionImage.html