MultiResolutionImageBaseMultiResolutionImagepublic abstract class AbstractMultiResolutionImage extends 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,
MultiResolutionImageaccelerationPriority, SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty| Constructor | Description |
|---|---|
AbstractMultiResolutionImage() |
| 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). |
flush, getAccelerationPriority, getCapabilities, getScaledInstance, setAccelerationPrioritygetResolutionVariant, getResolutionVariantspublic int getWidth(ImageObserver observer)
getBaseImage().getWidth(observer).getWidth in class Imageobserver - an object waiting for the image to be loaded.getBaseImage()public int getHeight(ImageObserver observer)
getBaseImage().getHeight(observer).getHeight in class Imageobserver - an object waiting for the image to be loaded.getBaseImage()public ImageProducer getSource()
getBaseImage().getSource().getSource in class ImagegetBaseImage()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 ImageUnsupportedOperationExceptionUnsupportedOperationException - this method is not supportedGraphics,
Component.createImage(int, int)public Object getProperty(String name, ImageObserver observer)
getBaseImage().getProperty(name, observer).getProperty in class Imagename - a property name.observer - an object waiting for this image to be loaded.getBaseImage()protected abstract 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-Debian+0-9b155-1