home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / awt / image / ImageObserver.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  5.6 KB  |  147 lines

  1. /*
  2.  * @(#)ImageObserver.java    1.20 98/03/18
  3.  *
  4.  * Copyright 1995-1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.awt.image;
  16.  
  17. import java.awt.Image;
  18.  
  19. /**
  20.  * An asynchronous update interface for receiving notifications about
  21.  * Image information as the Image is constructed.
  22.  *
  23.  * @version     1.20 03/18/98
  24.  * @author     Jim Graham
  25.  */
  26. public interface ImageObserver {
  27.     /**
  28.      * This method is called when information about an image which was
  29.      * previously requested using an asynchronous interface becomes
  30.      * available.  Asynchronous interfaces are method calls such as
  31.      * getWidth(ImageObserver) and drawImage(img, x, y, ImageObserver)
  32.      * which take an ImageObserver object as an argument.  Those methods
  33.      * register the caller as interested either in information about
  34.      * the overall image itself (in the case of getWidth(ImageObserver))
  35.      * or about an output version of an image (in the case of the
  36.      * drawImage(img, x, y, [w, h,] ImageObserver) call).  
  37.      *
  38.      * <p>This method
  39.      * should return true if further updates are needed or false if the
  40.      * required information has been acquired.  The image which was being
  41.      * tracked is passed in using the img argument.  Various constants
  42.      * are combined to form the infoflags argument which indicates what
  43.      * information about the image is now available.  The interpretation
  44.      * of the x, y, width, and height arguments depends on the contents
  45.      * of the infoflags argument.
  46.      * <p>
  47.      * The <code>infoflags</code> argument should be bitwise inclusive 
  48.      * <b>OR</b> of the following flags: <code>WIDTH</code>, 
  49.      * <code>HEIGHT</code>, <code>PROPERTIES</code>, <code>SOMEBITS</code>, 
  50.      * <code>FRAMEBITS</code>, <code>ALLBITS</code>, <code>ERROR</code>, 
  51.      * <code>ABORT</code>.
  52.      * @see #WIDTH
  53.      * @see #HEIGHT
  54.      * @see #PROPERTIES
  55.      * @see #SOMEBITS
  56.      * @see #FRAMEBITS
  57.      * @see #ALLBITS
  58.      * @see #ERROR
  59.      * @see #ABORT
  60.      * @see Image#getWidth
  61.      * @see Image#getHeight
  62.      * @see java.awt.Graphics#drawImage
  63.      */
  64.     public boolean imageUpdate(Image img, int infoflags,
  65.                    int x, int y, int width, int height);
  66.  
  67.     /**
  68.      * This flag in the infoflags argument to imageUpdate indicates that 
  69.      * the width of the base image is now available and can be taken
  70.      * from the width argument to the imageUpdate callback method.
  71.      * @see Image#getWidth
  72.      * @see #imageUpdate
  73.      */
  74.     public static final int WIDTH = 1;
  75.  
  76.     /**
  77.      * This flag in the infoflags argument to imageUpdate indicates that 
  78.      * the height of the base image is now available and can be taken
  79.      * from the height argument to the imageUpdate callback method.
  80.      * @see Image#getHeight
  81.      * @see #imageUpdate
  82.      */
  83.     public static final int HEIGHT = 2;
  84.  
  85.     /**
  86.      * This flag in the infoflags argument to imageUpdate indicates that 
  87.      * the properties of the image are now available.
  88.      * @see Image#getProperty
  89.      * @see #imageUpdate
  90.      */
  91.     public static final int PROPERTIES = 4;
  92.  
  93.     /**
  94.      * This flag in the infoflags argument to imageUpdate indicates that 
  95.      * more pixels needed for drawing a scaled variation of the image
  96.      * are available.  The bounding box of the new pixels can be taken
  97.      * from the x, y, width, and height arguments to the imageUpdate
  98.      * callback method.
  99.      * @see java.awt.Graphics#drawImage
  100.      * @see #imageUpdate
  101.      */
  102.     public static final int SOMEBITS = 8;
  103.  
  104.     /**
  105.      * This flag in the infoflags argument to imageUpdate indicates that 
  106.      * another complete frame of a multi-frame image which was previously
  107.      * drawn is now available to be drawn again.  The x, y, width, and height
  108.      * arguments to the imageUpdate callback method should be ignored.
  109.      * @see java.awt.Graphics#drawImage
  110.      * @see #imageUpdate
  111.      */
  112.     public static final int FRAMEBITS = 16;
  113.  
  114.     /**
  115.      * This flag in the infoflags argument to imageUpdate indicates that 
  116.      * a static image which was previously drawn is now complete and can
  117.      * be drawn again in its final form.  The x, y, width, and height
  118.      * arguments to the imageUpdate callback method should be ignored.
  119.      * @see java.awt.Graphics#drawImage
  120.      * @see #imageUpdate
  121.      */
  122.     public static final int ALLBITS = 32;
  123.  
  124.     /**
  125.      * This flag in the infoflags argument to imageUpdate indicates that 
  126.      * an image which was being tracked asynchronously has encountered
  127.      * an error.  No further information will become available and
  128.      * drawing the image will fail.
  129.      * As a convenience, the ABORT flag will be indicated at the same
  130.      * time to indicate that the image production was aborted.
  131.      * @see #imageUpdate
  132.      */
  133.     public static final int ERROR = 64;
  134.  
  135.     /**
  136.      * This flag in the infoflags argument to imageUpdate indicates that 
  137.      * an image which was being tracked asynchronously was aborted before
  138.      * production was complete.  No more information will become available
  139.      * without further action to trigger another image production sequence.
  140.      * If the ERROR flag was not also set in this image update, then
  141.      * accessing any of the data in the image will restart the production
  142.      * again, probably from the beginning.
  143.      * @see #imageUpdate
  144.      */
  145.     public static final int ABORT = 128;
  146. }
  147.