< prev index next >

src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java

Print this page




 216     public Object getProperty(String name, ImageObserver observer) {
 217         if (name == null) {
 218             throw new NullPointerException("null property name is not allowed");
 219         }
 220         return java.awt.Image.UndefinedProperty;
 221     }
 222 
 223     public int getWidth(ImageObserver observer) {
 224         return getWidth();
 225     }
 226 
 227     public int getHeight(ImageObserver observer) {
 228         return getHeight();
 229     }
 230 
 231     /**
 232      * This method creates a BufferedImage intended for use as a "snapshot"
 233      * or a backup surface.
 234      */
 235     public BufferedImage getBackupImage() {
 236         return graphicsConfig.createCompatibleImage(getWidth(), getHeight(),
 237                                                     getTransparency());









 238     }
 239 
 240     public BufferedImage getSnapshot() {
 241         BufferedImage bi = getBackupImage();
 242         Graphics2D g = bi.createGraphics();
 243         g.setComposite(AlphaComposite.Src);
 244         g.drawImage(this, 0, 0, null);
 245         g.dispose();
 246         return bi;
 247     }
 248 
 249     public int validate(GraphicsConfiguration gc) {
 250         return volSurfaceManager.validate(gc);
 251     }
 252 
 253     public boolean contentsLost() {
 254         return volSurfaceManager.contentsLost();
 255     }
 256 
 257     public ImageCapabilities getCapabilities() {


 216     public Object getProperty(String name, ImageObserver observer) {
 217         if (name == null) {
 218             throw new NullPointerException("null property name is not allowed");
 219         }
 220         return java.awt.Image.UndefinedProperty;
 221     }
 222 
 223     public int getWidth(ImageObserver observer) {
 224         return getWidth();
 225     }
 226 
 227     public int getHeight(ImageObserver observer) {
 228         return getHeight();
 229     }
 230 
 231     /**
 232      * This method creates a BufferedImage intended for use as a "snapshot"
 233      * or a backup surface.
 234      */
 235     public BufferedImage getBackupImage() {
 236         return getBackupImage(1, 1);
 237     }
 238 
 239     /**
 240      * This method creates a BufferedImage intended for use as a "snapshot"
 241      * or a backup surface with the given horizontal and vertical scale factors.
 242      */
 243     public BufferedImage getBackupImage(double scaleX, double scaleY) {
 244         int w = (int) Math.ceil(getWidth() * scaleX);
 245         int h = (int) Math.ceil(getHeight() * scaleY);
 246         return graphicsConfig.createCompatibleImage(w, h, getTransparency());
 247     }
 248 
 249     public BufferedImage getSnapshot() {
 250         BufferedImage bi = getBackupImage();
 251         Graphics2D g = bi.createGraphics();
 252         g.setComposite(AlphaComposite.Src);
 253         g.drawImage(this, 0, 0, null);
 254         g.dispose();
 255         return bi;
 256     }
 257 
 258     public int validate(GraphicsConfiguration gc) {
 259         return volSurfaceManager.validate(gc);
 260     }
 261 
 262     public boolean contentsLost() {
 263         return volSurfaceManager.contentsLost();
 264     }
 265 
 266     public ImageCapabilities getCapabilities() {
< prev index next >