001 /*
002 * Copyright 1995-1999 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package java.awt.image;
027
028 import java.awt.Image;
029
030 /**
031 * An asynchronous update interface for receiving notifications about
032 * Image information as the Image is constructed.
033 *
034 * @version 1.34 05/05/07
035 * @author Jim Graham
036 */
037 public interface ImageObserver {
038 /**
039 * This method is called when information about an image which was
040 * previously requested using an asynchronous interface becomes
041 * available. Asynchronous interfaces are method calls such as
042 * getWidth(ImageObserver) and drawImage(img, x, y, ImageObserver)
043 * which take an ImageObserver object as an argument. Those methods
044 * register the caller as interested either in information about
045 * the overall image itself (in the case of getWidth(ImageObserver))
046 * or about an output version of an image (in the case of the
047 * drawImage(img, x, y, [w, h,] ImageObserver) call).
048 *
049 * <p>This method
050 * should return true if further updates are needed or false if the
051 * required information has been acquired. The image which was being
052 * tracked is passed in using the img argument. Various constants
053 * are combined to form the infoflags argument which indicates what
054 * information about the image is now available. The interpretation
055 * of the x, y, width, and height arguments depends on the contents
056 * of the infoflags argument.
057 * <p>
058 * The <code>infoflags</code> argument should be the bitwise inclusive
059 * <b>OR</b> of the following flags: <code>WIDTH</code>,
060 * <code>HEIGHT</code>, <code>PROPERTIES</code>, <code>SOMEBITS</code>,
061 * <code>FRAMEBITS</code>, <code>ALLBITS</code>, <code>ERROR</code>,
062 * <code>ABORT</code>.
063 *
064 * @param img the image being observed.
065 * @param infoflags the bitwise inclusive OR of the following
066 * flags: <code>WIDTH</code>, <code>HEIGHT</code>,
067 * <code>PROPERTIES</code>, <code>SOMEBITS</code>,
068 * <code>FRAMEBITS</code>, <code>ALLBITS</code>,
069 * <code>ERROR</code>, <code>ABORT</code>.
070 * @param x the <i>x</i> coordinate.
071 * @param y the <i>y</i> coordinate.
072 * @param width the width.
073 * @param height the height.
074 * @return <code>false</code> if the infoflags indicate that the
075 * image is completely loaded; <code>true</code> otherwise.
076 *
077 * @see #WIDTH
078 * @see #HEIGHT
079 * @see #PROPERTIES
080 * @see #SOMEBITS
081 * @see #FRAMEBITS
082 * @see #ALLBITS
083 * @see #ERROR
084 * @see #ABORT
085 * @see Image#getWidth
086 * @see Image#getHeight
087 * @see java.awt.Graphics#drawImage
088 */
089 public boolean imageUpdate(Image img, int infoflags, int x, int y,
090 int width, int height);
091
092 /**
093 * This flag in the infoflags argument to imageUpdate indicates that
094 * the width of the base image is now available and can be taken
095 * from the width argument to the imageUpdate callback method.
096 * @see Image#getWidth
097 * @see #imageUpdate
098 */
099 public static final int WIDTH = 1;
100
101 /**
102 * This flag in the infoflags argument to imageUpdate indicates that
103 * the height of the base image is now available and can be taken
104 * from the height argument to the imageUpdate callback method.
105 * @see Image#getHeight
106 * @see #imageUpdate
107 */
108 public static final int HEIGHT = 2;
109
110 /**
111 * This flag in the infoflags argument to imageUpdate indicates that
112 * the properties of the image are now available.
113 * @see Image#getProperty
114 * @see #imageUpdate
115 */
116 public static final int PROPERTIES = 4;
117
118 /**
119 * This flag in the infoflags argument to imageUpdate indicates that
120 * more pixels needed for drawing a scaled variation of the image
121 * are available. The bounding box of the new pixels can be taken
122 * from the x, y, width, and height arguments to the imageUpdate
123 * callback method.
124 * @see java.awt.Graphics#drawImage
125 * @see #imageUpdate
126 */
127 public static final int SOMEBITS = 8;
128
129 /**
130 * This flag in the infoflags argument to imageUpdate indicates that
131 * another complete frame of a multi-frame image which was previously
132 * drawn is now available to be drawn again. The x, y, width, and height
133 * arguments to the imageUpdate callback method should be ignored.
134 * @see java.awt.Graphics#drawImage
135 * @see #imageUpdate
136 */
137 public static final int FRAMEBITS = 16;
138
139 /**
140 * This flag in the infoflags argument to imageUpdate indicates that
141 * a static image which was previously drawn is now complete and can
142 * be drawn again in its final form. The x, y, width, and height
143 * arguments to the imageUpdate callback method should be ignored.
144 * @see java.awt.Graphics#drawImage
145 * @see #imageUpdate
146 */
147 public static final int ALLBITS = 32;
148
149 /**
150 * This flag in the infoflags argument to imageUpdate indicates that
151 * an image which was being tracked asynchronously has encountered
152 * an error. No further information will become available and
153 * drawing the image will fail.
154 * As a convenience, the ABORT flag will be indicated at the same
155 * time to indicate that the image production was aborted.
156 * @see #imageUpdate
157 */
158 public static final int ERROR = 64;
159
160 /**
161 * This flag in the infoflags argument to imageUpdate indicates that
162 * an image which was being tracked asynchronously was aborted before
163 * production was complete. No more information will become available
164 * without further action to trigger another image production sequence.
165 * If the ERROR flag was not also set in this image update, then
166 * accessing any of the data in the image will restart the production
167 * again, probably from the beginning.
168 * @see #imageUpdate
169 */
170 public static final int ABORT = 128;
171 }
|