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