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