jdk/src/share/classes/java/awt/image/ImageObserver.java
author erikj
Thu, 07 Jun 2012 18:05:09 -0700
changeset 12813 c10ab96dcf41
parent 5506 202f599c92aa
child 16734 da1901d79073
permissions -rw-r--r--
7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI Reviewed-by: ohair, ohrstrom, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1995, 1999, 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
import javax.tools.annotation.GenerateNativeHeader;
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    31
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * An asynchronous update interface for receiving notifications about
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * Image information as the Image is constructed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * @author      Jim Graham
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 */
12813
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    38
/* No native methods here, but the constants are needed in the supporting JNI code */
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    39
@GenerateNativeHeader
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
public interface ImageObserver {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
     * This method is called when information about an image which was
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
     * previously requested using an asynchronous interface becomes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
     * available.  Asynchronous interfaces are method calls such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     * getWidth(ImageObserver) and drawImage(img, x, y, ImageObserver)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     * which take an ImageObserver object as an argument.  Those methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * register the caller as interested either in information about
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * the overall image itself (in the case of getWidth(ImageObserver))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * or about an output version of an image (in the case of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * drawImage(img, x, y, [w, h,] ImageObserver) call).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * <p>This method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * should return true if further updates are needed or false if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * required information has been acquired.  The image which was being
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * tracked is passed in using the img argument.  Various constants
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * are combined to form the infoflags argument which indicates what
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * information about the image is now available.  The interpretation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * of the x, y, width, and height arguments depends on the contents
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * of the infoflags argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * The <code>infoflags</code> argument should be the bitwise inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * <b>OR</b> of the following flags: <code>WIDTH</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * <code>HEIGHT</code>, <code>PROPERTIES</code>, <code>SOMEBITS</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * <code>FRAMEBITS</code>, <code>ALLBITS</code>, <code>ERROR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * <code>ABORT</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * @param     img   the image being observed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * @param     infoflags   the bitwise inclusive OR of the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     *               flags:  <code>WIDTH</code>, <code>HEIGHT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     *               <code>PROPERTIES</code>, <code>SOMEBITS</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     *               <code>FRAMEBITS</code>, <code>ALLBITS</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     *               <code>ERROR</code>, <code>ABORT</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * @param     x   the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * @param     y   the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * @param     width    the width.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @param     height   the height.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @return    <code>false</code> if the infoflags indicate that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *            image is completely loaded; <code>true</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @see #WIDTH
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @see #HEIGHT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * @see #PROPERTIES
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @see #SOMEBITS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @see #FRAMEBITS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @see #ALLBITS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * @see #ERROR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * @see #ABORT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * @see Image#getWidth
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * @see Image#getHeight
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @see java.awt.Graphics#drawImage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public boolean imageUpdate(Image img, int infoflags,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                               int x, int y, int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * This flag in the infoflags argument to imageUpdate indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * the width of the base image is now available and can be taken
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * from the width argument to the imageUpdate callback method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * @see Image#getWidth
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @see #imageUpdate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    public static final int WIDTH = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * This flag in the infoflags argument to imageUpdate indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * the height of the base image is now available and can be taken
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * from the height argument to the imageUpdate callback method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @see Image#getHeight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @see #imageUpdate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    public static final int HEIGHT = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * This flag in the infoflags argument to imageUpdate indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * the properties of the image are now available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @see Image#getProperty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @see #imageUpdate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    public static final int PROPERTIES = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * This flag in the infoflags argument to imageUpdate indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * more pixels needed for drawing a scaled variation of the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * are available.  The bounding box of the new pixels can be taken
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * from the x, y, width, and height arguments to the imageUpdate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * callback method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @see java.awt.Graphics#drawImage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * @see #imageUpdate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    public static final int SOMEBITS = 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * This flag in the infoflags argument to imageUpdate indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * another complete frame of a multi-frame image which was previously
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * drawn is now available to be drawn again.  The x, y, width, and height
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * arguments to the imageUpdate callback method should be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @see java.awt.Graphics#drawImage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @see #imageUpdate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    public static final int FRAMEBITS = 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * This flag in the infoflags argument to imageUpdate indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * a static image which was previously drawn is now complete and can
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * be drawn again in its final form.  The x, y, width, and height
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * arguments to the imageUpdate callback method should be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * @see java.awt.Graphics#drawImage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * @see #imageUpdate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    public static final int ALLBITS = 32;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * This flag in the infoflags argument to imageUpdate indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * an image which was being tracked asynchronously has encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * an error.  No further information will become available and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * drawing the image will fail.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * As a convenience, the ABORT flag will be indicated at the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * time to indicate that the image production was aborted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * @see #imageUpdate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    public static final int ERROR = 64;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * This flag in the infoflags argument to imageUpdate indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * an image which was being tracked asynchronously was aborted before
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * production was complete.  No more information will become available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * without further action to trigger another image production sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * If the ERROR flag was not also set in this image update, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * accessing any of the data in the image will restart the production
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * again, probably from the beginning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @see #imageUpdate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    public static final int ABORT = 128;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
}