Home » openjdk-7 » java » awt » image » [javadoc | source]

    1   /*
    2    * Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved.
    3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4    *
    5    * This code is free software; you can redistribute it and/or modify it
    6    * under the terms of the GNU General Public License version 2 only, as
    7    * published by the Free Software Foundation.  Oracle designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Oracle in the LICENSE file that accompanied this code.
   10    *
   11    * This code is distributed in the hope that it will be useful, but WITHOUT
   12    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14    * version 2 for more details (a copy is included in the LICENSE file that
   15    * accompanied this code).
   16    *
   17    * You should have received a copy of the GNU General Public License version
   18    * 2 along with this work; if not, write to the Free Software Foundation,
   19    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20    *
   21    * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   22    * or visit www.oracle.com if you need additional information or have any
   23    * questions.
   24    */
   25   
   26   package java.awt.image;
   27   
   28   import java.awt.Image;
   29   
   30   /**
   31    * An asynchronous update interface for receiving notifications about
   32    * Image information as the Image is constructed.
   33    *
   34    * @author      Jim Graham
   35    */
   36   public interface ImageObserver {
   37       /**
   38        * This method is called when information about an image which was
   39        * previously requested using an asynchronous interface becomes
   40        * available.  Asynchronous interfaces are method calls such as
   41        * getWidth(ImageObserver) and drawImage(img, x, y, ImageObserver)
   42        * which take an ImageObserver object as an argument.  Those methods
   43        * register the caller as interested either in information about
   44        * the overall image itself (in the case of getWidth(ImageObserver))
   45        * or about an output version of an image (in the case of the
   46        * drawImage(img, x, y, [w, h,] ImageObserver) call).
   47        *
   48        * <p>This method
   49        * should return true if further updates are needed or false if the
   50        * required information has been acquired.  The image which was being
   51        * tracked is passed in using the img argument.  Various constants
   52        * are combined to form the infoflags argument which indicates what
   53        * information about the image is now available.  The interpretation
   54        * of the x, y, width, and height arguments depends on the contents
   55        * of the infoflags argument.
   56        * <p>
   57        * The <code>infoflags</code> argument should be the bitwise inclusive
   58        * <b>OR</b> of the following flags: <code>WIDTH</code>,
   59        * <code>HEIGHT</code>, <code>PROPERTIES</code>, <code>SOMEBITS</code>,
   60        * <code>FRAMEBITS</code>, <code>ALLBITS</code>, <code>ERROR</code>,
   61        * <code>ABORT</code>.
   62        *
   63        * @param     img   the image being observed.
   64        * @param     infoflags   the bitwise inclusive OR of the following
   65        *               flags:  <code>WIDTH</code>, <code>HEIGHT</code>,
   66        *               <code>PROPERTIES</code>, <code>SOMEBITS</code>,
   67        *               <code>FRAMEBITS</code>, <code>ALLBITS</code>,
   68        *               <code>ERROR</code>, <code>ABORT</code>.
   69        * @param     x   the <i>x</i> coordinate.
   70        * @param     y   the <i>y</i> coordinate.
   71        * @param     width    the width.
   72        * @param     height   the height.
   73        * @return    <code>false</code> if the infoflags indicate that the
   74        *            image is completely loaded; <code>true</code> otherwise.
   75        *
   76        * @see #WIDTH
   77        * @see #HEIGHT
   78        * @see #PROPERTIES
   79        * @see #SOMEBITS
   80        * @see #FRAMEBITS
   81        * @see #ALLBITS
   82        * @see #ERROR
   83        * @see #ABORT
   84        * @see Image#getWidth
   85        * @see Image#getHeight
   86        * @see java.awt.Graphics#drawImage
   87        */
   88       public boolean imageUpdate(Image img, int infoflags,
   89                                  int x, int y, int width, int height);
   90   
   91       /**
   92        * This flag in the infoflags argument to imageUpdate indicates that
   93        * the width of the base image is now available and can be taken
   94        * from the width argument to the imageUpdate callback method.
   95        * @see Image#getWidth
   96        * @see #imageUpdate
   97        */
   98       public static final int WIDTH = 1;
   99   
  100       /**
  101        * This flag in the infoflags argument to imageUpdate indicates that
  102        * the height of the base image is now available and can be taken
  103        * from the height argument to the imageUpdate callback method.
  104        * @see Image#getHeight
  105        * @see #imageUpdate
  106        */
  107       public static final int HEIGHT = 2;
  108   
  109       /**
  110        * This flag in the infoflags argument to imageUpdate indicates that
  111        * the properties of the image are now available.
  112        * @see Image#getProperty
  113        * @see #imageUpdate
  114        */
  115       public static final int PROPERTIES = 4;
  116   
  117       /**
  118        * This flag in the infoflags argument to imageUpdate indicates that
  119        * more pixels needed for drawing a scaled variation of the image
  120        * are available.  The bounding box of the new pixels can be taken
  121        * from the x, y, width, and height arguments to the imageUpdate
  122        * callback method.
  123        * @see java.awt.Graphics#drawImage
  124        * @see #imageUpdate
  125        */
  126       public static final int SOMEBITS = 8;
  127   
  128       /**
  129        * This flag in the infoflags argument to imageUpdate indicates that
  130        * another complete frame of a multi-frame image which was previously
  131        * drawn is now available to be drawn again.  The x, y, width, and height
  132        * arguments to the imageUpdate callback method should be ignored.
  133        * @see java.awt.Graphics#drawImage
  134        * @see #imageUpdate
  135        */
  136       public static final int FRAMEBITS = 16;
  137   
  138       /**
  139        * This flag in the infoflags argument to imageUpdate indicates that
  140        * a static image which was previously drawn is now complete and can
  141        * be drawn again in its final form.  The x, y, width, and height
  142        * arguments to the imageUpdate callback method should be ignored.
  143        * @see java.awt.Graphics#drawImage
  144        * @see #imageUpdate
  145        */
  146       public static final int ALLBITS = 32;
  147   
  148       /**
  149        * This flag in the infoflags argument to imageUpdate indicates that
  150        * an image which was being tracked asynchronously has encountered
  151        * an error.  No further information will become available and
  152        * drawing the image will fail.
  153        * As a convenience, the ABORT flag will be indicated at the same
  154        * time to indicate that the image production was aborted.
  155        * @see #imageUpdate
  156        */
  157       public static final int ERROR = 64;
  158   
  159       /**
  160        * This flag in the infoflags argument to imageUpdate indicates that
  161        * an image which was being tracked asynchronously was aborted before
  162        * production was complete.  No more information will become available
  163        * without further action to trigger another image production sequence.
  164        * If the ERROR flag was not also set in this image update, then
  165        * accessing any of the data in the image will restart the production
  166        * again, probably from the beginning.
  167        * @see #imageUpdate
  168        */
  169       public static final int ABORT = 128;
  170   }

Home » openjdk-7 » java » awt » image » [javadoc | source]