MultiResolutionImageBaseMultiResolutionImagepublic abstract class AbstractMultiResolutionImage extends java.awt.Image implements MultiResolutionImage
Image methods
for classes that want to implement the 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];
}
}
Image,
MultiResolutionImage| Constructor | Description |
|---|---|
AbstractMultiResolutionImage() |
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract java.awt.Image |
getBaseImage() |
Return the base image representing the best version of the image for
rendering at the default width and height.
|
java.awt.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). |
flush, getAccelerationPriority, getCapabilities, getScaledInstance, setAccelerationPrioritygetResolutionVariant, getResolutionVariantspublic int getWidth(ImageObserver observer)
getBaseImage().getWidth(observer).getWidth in class java.awt.Imageobserver - an object waiting for the image to be loaded.getBaseImage()public int getHeight(ImageObserver observer)
getBaseImage().getHeight(observer).getHeight in class java.awt.Imageobserver - an object waiting for the image to be loaded.getBaseImage()public ImageProducer getSource()
getBaseImage().getSource().getSource in class java.awt.ImagegetBaseImage()public java.awt.Graphics getGraphics()
Image#getGraphics() method,
this implementation will always throw UnsupportedOperationException
since only off-screen images can return a Graphics object.getGraphics in class java.awt.ImageUnsupportedOperationExceptionUnsupportedOperationException - this method is not supportedGraphics,
Component.createImage(int, int)public Object getProperty(String name, ImageObserver observer)
getBaseImage().getProperty(name, observer).getProperty in class java.awt.Imagename - a property name.observer - an object waiting for this image to be loaded.getBaseImage()protected abstract java.awt.Image getBaseImage()
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.abuild.jdk9-71a766d4c180