APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt.image

public abstract Class AbstractMultiResolutionImage

extends Image
implements MultiResolutionImage
Class Inheritance
All Implemented Interfaces
java.awt.image.MultiResolutionImage
Known Direct Subclasses
java.awt.image.BaseMultiResolutionImage, javax.swing.JViewport.BackingStoreMultiResolutionImage, sun.swing.CachedPainter.PainterMultiResolutionCachedImage, sun.awt.image.MultiResolutionCachedImage
Imports
java.awt.Graphics, .Image

This class provides default implementations of several 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];
    }
}
 
Since
9
See Also
java.awt.Image, java.awt.image.MultiResolutionImage

Field Summary

Inherited from java.awt.Image:
accelerationPrioritySCALE_AREA_AVERAGINGSCALE_DEFAULTSCALE_FASTSCALE_REPLICATESCALE_SMOOTHUndefinedProperty

Constructor Summary

AccessConstructor and Description
protected
AbstractMultiResolutionImage()

Constructor for subclasses to call.

Method Summary

Modifier and TypeMethod and Description
protected abstract Image

Returns:

the base image of the set of multi-resolution images
getBaseImage
()

Return the base image representing the best version of the image for rendering at the default width and height.

public Graphics

Returns:

throws UnsupportedOperationException
getGraphics
()

Implements abstract java.awt.Image.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.

public int

Returns:

the height of the base image, or -1 if the height is not yet known
getHeight
(ImageObserver observer)

Implements abstract java.awt.Image.getHeight.

This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getHeight(observer).

public Object

Returns:

the value of the named property in the base image
getProperty
(String name, ImageObserver observer)

Implements abstract java.awt.Image.getProperty.

This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getProperty(name, observer).

public ImageProducer

Returns:

the image producer that produces the pixels for the base image
getSource
()

Implements abstract java.awt.Image.getSource.

This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getSource().

public int

Returns:

the width of the base image, or -1 if the width is not yet known
getWidth
(ImageObserver observer)

Implements abstract java.awt.Image.getWidth.

This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getWidth(observer).

Inherited from java.awt.Image:
flushgetAccelerationPrioritygetCapabilitiesgetScaledInstancesetAccelerationPriority

Constructor Detail

AbstractMultiResolutionImageback to summary
protected AbstractMultiResolutionImage()

Constructor for subclasses to call.

Method Detail

getBaseImageback to summary
protected abstract Image getBaseImage()

Return the base image representing the best version of the image for rendering at the default width and height.

Returns:Image

the base image of the set of multi-resolution images

Since
9
getGraphicsback to summary
public Graphics getGraphics()

Implements abstract java.awt.Image.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.

Returns:Graphics

throws UnsupportedOperationException

Annotations
@Override
Exceptions
UnsupportedOperationException:
this method is not supported
getHeightback to summary
public int getHeight(ImageObserver observer)

Implements abstract java.awt.Image.getHeight.

This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getHeight(observer).

Returns:int

the height of the base image, or -1 if the height is not yet known

Annotations
@Override
Since
9
See Also
getBaseImage()
getPropertyback to summary
public Object getProperty(String name, ImageObserver observer)

Implements abstract java.awt.Image.getProperty.

This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getProperty(name, observer).

Returns:Object

the value of the named property in the base image

Annotations
@Override
Since
9
See Also
getBaseImage()
getSourceback to summary
public ImageProducer getSource()

Implements abstract java.awt.Image.getSource.

This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getSource().

Returns:ImageProducer

the image producer that produces the pixels for the base image

Annotations
@Override
Since
9
See Also
getBaseImage()
getWidthback to summary
public int getWidth(ImageObserver observer)

Implements abstract java.awt.Image.getWidth.

This method simply delegates to the same method on the base image and it is equivalent to: getBaseImage().getWidth(observer).

Returns:int

the width of the base image, or -1 if the width is not yet known

Annotations
@Override
Since
9
See Also
getBaseImage()