home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / java.z / ImageObserver.java < prev    next >
Text File  |  1996-05-03  |  5KB  |  130 lines

  1. /*
  2.  * @(#)ImageObserver.java    1.16 95/12/14 Jim Graham
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package java.awt.image;
  21.  
  22. import java.awt.Image;
  23.  
  24. /**
  25.  * An asynchronous update interface for receiving notifications about
  26.  * Image information as the Image is constructed.
  27.  *
  28.  * @version     1.16 14 Dec 1995
  29.  * @author     Jim Graham
  30.  */
  31. public interface ImageObserver {
  32.     /**
  33.      * This method is called when information about an image which was
  34.      * previously requested using an asynchronous interface becomes
  35.      * available.  Asynchronous interfaces are method calls such as
  36.      * getWidth(ImageObserver) and drawImage(img, x, y, ImageObserver)
  37.      * which take an ImageObserver object as an argument.  Those methods
  38.      * register the caller as interested either in information about
  39.      * the overall image itself (in the case of getWidth(ImageObserver))
  40.      * or about an output version of an image (in the case of the
  41.      * drawImage(img, x, y, [w, h,] ImageObserver) call).  
  42.  
  43.      * <p>This method
  44.      * should return true if further updates are needed or false if the
  45.      * required information has been acquired.  The image which was being
  46.      * tracked is passed in using the img argument.  Various constants
  47.      * are combined to form the infoflags argument which indicates what
  48.      * information about the image is now available.  The interpretation
  49.      * of the x, y, width, and height arguments depends on the contents
  50.      * of the infoflags argument.
  51.      * @see Image#getWidth
  52.      * @see Image#getHeight
  53.      * @see java.awt.Graphics#drawImage
  54.      */
  55.     public boolean imageUpdate(Image img, int infoflags,
  56.                    int x, int y, int width, int height);
  57.  
  58.     /**
  59.      * The width of the base image is now available and can be taken
  60.      * from the width argument to the imageUpdate callback method.
  61.      * @see Image#getWidth
  62.      * @see #imageUpdate
  63.      */
  64.     public static final int WIDTH = 1;
  65.  
  66.     /**
  67.      * The height of the base image is now available and can be taken
  68.      * from the height argument to the imageUpdate callback method.
  69.      * @see Image#getHeight
  70.      * @see #imageUpdate
  71.      */
  72.     public static final int HEIGHT = 2;
  73.  
  74.     /**
  75.      * The properties of the image are now available.
  76.      * @see Image#getProperty
  77.      * @see #imageUpdate
  78.      */
  79.     public static final int PROPERTIES = 4;
  80.  
  81.     /**
  82.      * More pixels needed for drawing a scaled variation of the image
  83.      * are available.  The bounding box of the new pixels can be taken
  84.      * from the x, y, width, and height arguments to the imageUpdate
  85.      * callback method.
  86.      * @see java.awt.Graphics#drawImage
  87.      * @see #imageUpdate
  88.      */
  89.     public static final int SOMEBITS = 8;
  90.  
  91.     /**
  92.      * Another complete frame of a multi-frame image which was previously
  93.      * drawn is now available to be drawn again.  The x, y, width, and height
  94.      * arguments to the imageUpdate callback method should be ignored.
  95.      * @see java.awt.Graphics#drawImage
  96.      * @see #imageUpdate
  97.      */
  98.     public static final int FRAMEBITS = 16;
  99.  
  100.     /**
  101.      * A static image which was previously drawn is now complete and can
  102.      * be drawn again in its final form.  The x, y, width, and height
  103.      * arguments to the imageUpdate callback method should be ignored.
  104.      * @see java.awt.Graphics#drawImage
  105.      * @see #imageUpdate
  106.      */
  107.     public static final int ALLBITS = 32;
  108.  
  109.     /**
  110.      * An image which was being tracked asynchronously has encountered
  111.      * an error.  No further information will become available and
  112.      * drawing the image will fail.
  113.      * As a convenience, the ABORT flag will be indicated at the same
  114.      * time to indicate that the image production was aborted.
  115.      * @see #imageUpdate
  116.      */
  117.     public static final int ERROR = 64;
  118.  
  119.     /**
  120.      * An image which was being tracked asynchronously was aborted before
  121.      * production was complete.  No more information will become available
  122.      * without further action to trigger another image production sequence.
  123.      * If the ERROR flag was not also set in this image update, then
  124.      * accessing any of the data in the image will restart the production
  125.      * again, probably from the beginning.
  126.      * @see #imageUpdate
  127.      */
  128.     public static final int ABORT = 128;
  129. }
  130.