- java.lang.Object
- 
- java.awt.Image
- 
- java.awt.image.AbstractMultiResolutionImage
 
 
- 
- All Implemented Interfaces:
- MultiResolutionImage
 - Direct Known Subclasses:
- BaseMultiResolutionImage
 
 public abstract class AbstractMultiResolutionImage extends Image implements MultiResolutionImage This class provides default implementations of severalImagemethods for classes that want to implement theMultiResolutionImageinterface. 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:
- Image,- MultiResolutionImage
 
- 
- 
Field Summary- 
Fields declared in class java.awt.ImageaccelerationPriority, SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractMultiResolutionImage()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ImagegetBaseImage()Return the base image representing the best version of the image for rendering at the default width and height.GraphicsgetGraphics()As per the contract of the baseImage#getGraphics()method, this implementation will always throwUnsupportedOperationExceptionsince only off-screen images can return aGraphicsobject.intgetHeight(ImageObserver observer)This method simply delegates to the same method on the base image and it is equivalent to:getBaseImage().getHeight(observer).ObjectgetProperty(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).ImageProducergetSource()This method simply delegates to the same method on the base image and it is equivalent to:getBaseImage().getSource().intgetWidth(ImageObserver observer)This method simply delegates to the same method on the base image and it is equivalent to:getBaseImage().getWidth(observer).- 
Methods declared in class java.awt.Imageflush, getAccelerationPriority, getCapabilities, getScaledInstance, setAccelerationPriority
 - 
Methods declared in class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods declared in interface java.awt.image.MultiResolutionImagegetResolutionVariant, getResolutionVariants
 
- 
 
- 
- 
- 
Method Detail- 
getWidthpublic int getWidth(ImageObserver observer) This method simply delegates to the same method on the base image and it is equivalent to:getBaseImage().getWidth(observer).- Specified by:
- getWidthin class- Image
- Parameters:
- observer- an object waiting for the image to be loaded.
- Returns:
- the width of the base image, or -1 if the width is not yet known
- Since:
- 9
- See Also:
- getBaseImage()
 
 - 
getHeightpublic int getHeight(ImageObserver observer) This method simply delegates to the same method on the base image and it is equivalent to:getBaseImage().getHeight(observer).- Specified by:
- getHeightin class- Image
- Parameters:
- observer- an object waiting for the image to be loaded.
- Returns:
- the height of the base image, or -1 if the height is not yet known
- Since:
- 9
- See Also:
- getBaseImage()
 
 - 
getSourcepublic ImageProducer getSource() This method simply delegates to the same method on the base image and it is equivalent to:getBaseImage().getSource().- Specified by:
- getSourcein class- Image
- Returns:
- the image producer that produces the pixels for the base image
- Since:
- 9
- See Also:
- getBaseImage()
 
 - 
getGraphicspublic Graphics getGraphics() As per the contract of the baseImage#getGraphics()method, this implementation will always throwUnsupportedOperationExceptionsince only off-screen images can return aGraphicsobject.- Specified by:
- getGraphicsin class- Image
- Returns:
- throws UnsupportedOperationException
- Throws:
- UnsupportedOperationException- this method is not supported
- See Also:
- Graphics,- Component.createImage(int, int)
 
 - 
getPropertypublic 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).- Specified by:
- getPropertyin class- Image
- Parameters:
- name- a property name.
- observer- an object waiting for this image to be loaded.
- Returns:
- the value of the named property in the base image
- Since:
- 9
- See Also:
- getBaseImage()
 
 - 
getBaseImageprotected abstract Image getBaseImage() Return the base image representing the best version of the image for rendering at the default width and height.- Returns:
- the base image of the set of multi-resolution images
- Since:
- 9
 
 
- 
 
-