KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > swingwt > awt > image > VolatileImage


1 /*
2    SwingWT
3    Copyright(c)2003-2004, R. Rawson-Tetley
4
5    For more information on distributing and using this program, please
6    see the accompanying "COPYING" file.
7
8    Contact me by electronic mail: bobintetley@users.sourceforge.net
9
10    $Log: VolatileImage.java,v $
11    Revision 1.2 2004/01/15 15:20:30 bobintetley
12    Java2D work
13
14
15 */

16 package swingwt.awt.image;
17
18 import swingwt.awt.*;
19
20 /**
21  * Actually implemented it useful enough to do something :)
22  * Although it is abstract in AWT, there is no need to make it
23  * abstract here, since we can now use a straight image and
24  * just override the bits of behaviour we want.
25  *
26  * @author Robin Rawson-Tetley
27  */

28 public class VolatileImage extends BufferedImage {
29     
30     public static final int IMAGE_OK = 0;
31     public static final int IMAGE_RESTORED = 1;
32     public static final int IMAGE_INCOMPATIBLE = 2;
33     
34     public VolatileImage(int width, int height, int imagetype) { super(width, height, imagetype); }
35     
36     public BufferedImage getSnapshot() { return this; }
37
38     public int getWidth() { return super.getWidth(null); }
39     public int getHeight() { return super.getHeight(null); }
40     //public ImageProducer getSource() { return null; }
41
public void flush() { }
42     public int validate(GraphicsConfiguration gc) { return IMAGE_OK; }
43     public boolean contentsLost() { return false; }
44     public ImageCapabilities getCapabilities() { return new ImageCapabilities(true); }
45
46 }
Popular Tags