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 and Description |
---|
AbstractMultiResolutionImage() |
Modifier and Type | Method and 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()
Creates a graphics context for drawing to an off-screen image.
|
int |
getHeight(ImageObserver observer)
Determines the height of the image.
|
Object |
getProperty(String name,
ImageObserver observer)
Gets a property of this image by name.
|
ImageProducer |
getSource()
Gets the object that produces the pixels for the image.
|
int |
getWidth(ImageObserver observer)
Determines the width of the image.
|
flush, getAccelerationPriority, getCapabilities, getScaledInstance, setAccelerationPriority
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getResolutionVariant, getResolutionVariants
public int getWidth(ImageObserver observer)
Image
-1
and the specified
ImageObserver
object is notified later.getWidth
in class Image
observer
- an object waiting for the image to be loaded.-1
if the width is not yet known.Image.getHeight(java.awt.image.ImageObserver)
,
ImageObserver
public int getHeight(ImageObserver observer)
Image
-1
and the specified
ImageObserver
object is notified later.getHeight
in class Image
observer
- an object waiting for the image to be loaded.-1
if the height is not yet known.Image.getWidth(java.awt.image.ImageObserver)
,
ImageObserver
public ImageProducer getSource()
Image
getSource
in class Image
ImageProducer
public Graphics getGraphics()
Image
getGraphics
in class Image
Graphics
,
Component.createImage(int, int)
public Object getProperty(String name, ImageObserver observer)
Image
Individual property names are defined by the various image
formats. If a property is not defined for a particular image, this
method returns the UndefinedProperty
object.
If the properties for this image are not yet known, this method
returns null
, and the ImageObserver
object is notified later.
The property name "comment"
should be used to store
an optional comment which can be presented to the application as a
description of the image, its source, or its author.
getProperty
in class Image
name
- a property name.observer
- an object waiting for this image to be loaded.ImageObserver
,
Image.UndefinedProperty
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, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-internal+0-2016-01-26-133437.ivan.openjdk9onspinwait