MultiResolutionImage
BaseMultiResolutionImage
public 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
,
MultiResolutionImage
accelerationPriority, 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, setAccelerationPriority
getResolutionVariant, getResolutionVariants
public int getWidth(ImageObserver observer)
getBaseImage().getWidth(observer)
.getWidth
in class Image
observer
- an object waiting for the image to be loaded.getBaseImage()
public int getHeight(ImageObserver observer)
getBaseImage().getHeight(observer)
.getHeight
in class Image
observer
- an object waiting for the image to be loaded.getBaseImage()
public ImageProducer getSource()
getBaseImage().getSource()
.getSource
in class Image
getBaseImage()
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 supportedGraphics
,
Component.createImage(int, int)
public 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.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-internal+0-adhoc.mlchung.jdk9-jdeps