< prev index next >

jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java

Print this page




  42  *     }
  43  *
  44  *     public Image getResolutionVariant(
  45  *             double destImageWidth, double destImageHeight) {
  46  *         // return a resolution variant based on the given destination image size
  47  *     }
  48  *
  49  *     public List<Image> getResolutionVariants() {
  50  *         return Collections.unmodifiableList(Arrays.asList(resolutionVariants));
  51  *     }
  52  *
  53  *     protected Image getBaseImage() {
  54  *         return resolutionVariants[0];
  55  *     }
  56  * }
  57  * } </pre>
  58  *
  59  * @see java.awt.Image
  60  * @see java.awt.image.MultiResolutionImage
  61  *
  62  * @since 1.9
  63  */
  64 public abstract class AbstractMultiResolutionImage extends java.awt.Image
  65         implements MultiResolutionImage {
  66 
  67     @Override
  68     public int getWidth(ImageObserver observer) {
  69         return getBaseImage().getWidth(observer);
  70     }
  71 
  72     @Override
  73     public int getHeight(ImageObserver observer) {
  74         return getBaseImage().getHeight(observer);
  75     }
  76 
  77     @Override
  78     public ImageProducer getSource() {
  79         return getBaseImage().getSource();
  80     }
  81 
  82     @Override
  83     public Graphics getGraphics() {
  84         throw new UnsupportedOperationException("getGraphics() not supported"
  85                 + " on Multi-Resolution Images");
  86     }
  87 
  88     @Override
  89     public Object getProperty(String name, ImageObserver observer) {
  90         return getBaseImage().getProperty(name, observer);
  91     }
  92 
  93     /**
  94      * Return the base image representing the best version of the image for
  95      * rendering at the default width and height.
  96      *
  97      * @return the base image of the set of multi-resolution images
  98      *
  99      * @since 1.9
 100      */
 101     protected abstract Image getBaseImage();


  42  *     }
  43  *
  44  *     public Image getResolutionVariant(
  45  *             double destImageWidth, double destImageHeight) {
  46  *         // return a resolution variant based on the given destination image size
  47  *     }
  48  *
  49  *     public List<Image> getResolutionVariants() {
  50  *         return Collections.unmodifiableList(Arrays.asList(resolutionVariants));
  51  *     }
  52  *
  53  *     protected Image getBaseImage() {
  54  *         return resolutionVariants[0];
  55  *     }
  56  * }
  57  * } </pre>
  58  *
  59  * @see java.awt.Image
  60  * @see java.awt.image.MultiResolutionImage
  61  *
  62  * @since 9
  63  */
  64 public abstract class AbstractMultiResolutionImage extends java.awt.Image
  65         implements MultiResolutionImage {
  66 
  67     @Override
  68     public int getWidth(ImageObserver observer) {
  69         return getBaseImage().getWidth(observer);
  70     }
  71 
  72     @Override
  73     public int getHeight(ImageObserver observer) {
  74         return getBaseImage().getHeight(observer);
  75     }
  76 
  77     @Override
  78     public ImageProducer getSource() {
  79         return getBaseImage().getSource();
  80     }
  81 
  82     @Override
  83     public Graphics getGraphics() {
  84         throw new UnsupportedOperationException("getGraphics() not supported"
  85                 + " on Multi-Resolution Images");
  86     }
  87 
  88     @Override
  89     public Object getProperty(String name, ImageObserver observer) {
  90         return getBaseImage().getProperty(name, observer);
  91     }
  92 
  93     /**
  94      * Return the base image representing the best version of the image for
  95      * rendering at the default width and height.
  96      *
  97      * @return the base image of the set of multi-resolution images
  98      *
  99      * @since 9
 100      */
 101     protected abstract Image getBaseImage();
< prev index next >