KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > image > ImageObserver


1 /*
2  * @(#)ImageObserver.java 1.27 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt.image;
9
10 import java.awt.Image JavaDoc;
11
12 /**
13  * An asynchronous update interface for receiving notifications about
14  * Image information as the Image is constructed.
15  *
16  * @version 1.27 12/19/03
17  * @author Jim Graham
18  */

19 public interface ImageObserver {
20     /**
21      * This method is called when information about an image which was
22      * previously requested using an asynchronous interface becomes
23      * available. Asynchronous interfaces are method calls such as
24      * getWidth(ImageObserver) and drawImage(img, x, y, ImageObserver)
25      * which take an ImageObserver object as an argument. Those methods
26      * register the caller as interested either in information about
27      * the overall image itself (in the case of getWidth(ImageObserver))
28      * or about an output version of an image (in the case of the
29      * drawImage(img, x, y, [w, h,] ImageObserver) call).
30      *
31      * <p>This method
32      * should return true if further updates are needed or false if the
33      * required information has been acquired. The image which was being
34      * tracked is passed in using the img argument. Various constants
35      * are combined to form the infoflags argument which indicates what
36      * information about the image is now available. The interpretation
37      * of the x, y, width, and height arguments depends on the contents
38      * of the infoflags argument.
39      * <p>
40      * The <code>infoflags</code> argument should be the bitwise inclusive
41      * <b>OR</b> of the following flags: <code>WIDTH</code>,
42      * <code>HEIGHT</code>, <code>PROPERTIES</code>, <code>SOMEBITS</code>,
43      * <code>FRAMEBITS</code>, <code>ALLBITS</code>, <code>ERROR</code>,
44      * <code>ABORT</code>.
45      *
46      * @param img the image being observed.
47      * @param infoflags the bitwise inclusive OR of the following
48      * flags: <code>WIDTH</code>, <code>HEIGHT</code>,
49      * <code>PROPERTIES</code>, <code>SOMEBITS</code>,
50      * <code>FRAMEBITS</code>, <code>ALLBITS</code>,
51      * <code>ERROR</code>, <code>ABORT</code>.
52      * @param x the <i>x</i> coordinate.
53      * @param y the <i>y</i> coordinate.
54      * @param width the width.
55      * @param height the height.
56      * @return <code>false</code> if the infoflags indicate that the
57      * image is completely loaded; <code>true</code> otherwise.
58      *
59      * @see #WIDTH
60      * @see #HEIGHT
61      * @see #PROPERTIES
62      * @see #SOMEBITS
63      * @see #FRAMEBITS
64      * @see #ALLBITS
65      * @see #ERROR
66      * @see #ABORT
67      * @see Image#getWidth
68      * @see Image#getHeight
69      * @see java.awt.Graphics#drawImage
70      */

71     public boolean imageUpdate(Image JavaDoc img, int infoflags,
72                    int x, int y, int width, int height);
73
74     /**
75      * This flag in the infoflags argument to imageUpdate indicates that
76      * the width of the base image is now available and can be taken
77      * from the width argument to the imageUpdate callback method.
78      * @see Image#getWidth
79      * @see #imageUpdate
80      */

81     public static final int WIDTH = 1;
82
83     /**
84      * This flag in the infoflags argument to imageUpdate indicates that
85      * the height of the base image is now available and can be taken
86      * from the height argument to the imageUpdate callback method.
87      * @see Image#getHeight
88      * @see #imageUpdate
89      */

90     public static final int HEIGHT = 2;
91
92     /**
93      * This flag in the infoflags argument to imageUpdate indicates that
94      * the properties of the image are now available.
95      * @see Image#getProperty
96      * @see #imageUpdate
97      */

98     public static final int PROPERTIES = 4;
99
100     /**
101      * This flag in the infoflags argument to imageUpdate indicates that
102      * more pixels needed for drawing a scaled variation of the image
103      * are available. The bounding box of the new pixels can be taken
104      * from the x, y, width, and height arguments to the imageUpdate
105      * callback method.
106      * @see java.awt.Graphics#drawImage
107      * @see #imageUpdate
108      */

109     public static final int SOMEBITS = 8;
110
111     /**
112      * This flag in the infoflags argument to imageUpdate indicates that
113      * another complete frame of a multi-frame image which was previously
114      * drawn is now available to be drawn again. The x, y, width, and height
115      * arguments to the imageUpdate callback method should be ignored.
116      * @see java.awt.Graphics#drawImage
117      * @see #imageUpdate
118      */

119     public static final int FRAMEBITS = 16;
120
121     /**
122      * This flag in the infoflags argument to imageUpdate indicates that
123      * a static image which was previously drawn is now complete and can
124      * be drawn again in its final form. The x, y, width, and height
125      * arguments to the imageUpdate callback method should be ignored.
126      * @see java.awt.Graphics#drawImage
127      * @see #imageUpdate
128      */

129     public static final int ALLBITS = 32;
130
131     /**
132      * This flag in the infoflags argument to imageUpdate indicates that
133      * an image which was being tracked asynchronously has encountered
134      * an error. No further information will become available and
135      * drawing the image will fail.
136      * As a convenience, the ABORT flag will be indicated at the same
137      * time to indicate that the image production was aborted.
138      * @see #imageUpdate
139      */

140     public static final int ERROR = 64;
141
142     /**
143      * This flag in the infoflags argument to imageUpdate indicates that
144      * an image which was being tracked asynchronously was aborted before
145      * production was complete. No more information will become available
146      * without further action to trigger another image production sequence.
147      * If the ERROR flag was not also set in this image update, then
148      * accessing any of the data in the image will restart the production
149      * again, probably from the beginning.
150      * @see #imageUpdate
151      */

152     public static final int ABORT = 128;
153 }
154
Popular Tags