Imported GNU Classpath 0.19 + gcj-import-20051115.
[official-gcc.git] / libjava / classpath / java / awt / image / ImageConsumer.java
blobfc5ed11e5ca56de42a52d8a0ff6c734b0f2f716e
1 /* ImageConsumer.java -- Java interface for image consumption
2 Copyright (C) 1999, 2003 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package java.awt.image;
41 import java.util.Hashtable;
43 /**
44 * An object implementing the <code>ImageProducer</code> interface can
45 * use objects implementing this interface to deliver the image data.
47 * @author C. Brian Jones (cbj@gnu.org)
49 public interface ImageConsumer
51 /**
52 * The pixel order may be random. This should be
53 * the default assumption of the <code>ImageConsumer</code>.
55 * @see #setHints
57 int RANDOMPIXELORDER = 1;
59 /**
60 * The pixel order is top-down, left-right.
62 * @see #setHints
64 int TOPDOWNLEFTRIGHT = 2;
66 /**
67 * The pixel order is in multiples of complete scanlines.
69 * @see #setHints
71 int COMPLETESCANLINES = 4;
73 /**
74 * The pixels will be delivered in a single pass. There is at
75 * most one call to <code>setPixels</code> for any single pixel.
77 * @see #setHints
78 * @see #setPixels(int, int, int, int, ColorModel, int[], int, int)
80 int SINGLEPASS = 8;
82 /**
83 * The pixels will be delivered with multiple calls to
84 * <code>setPixels</code>. The image contains a single frame
85 * which ends when <code>imageComplete</code> is called with the
86 * <code>STATICIMAGEDONE</code> flag. If the image is constantly
87 * changing such as with video then the end of each frame is
88 * marked by a similar call to <code>imageComplete</code> with the
89 * <code>SINGLEFRAMEDONE</code> flag.
91 * @see #setHints
92 * @see #imageComplete
94 int SINGLEFRAME = 16;
96 /**
97 * Indicates an error occurred while producing an image.
99 * @see #imageComplete
101 int IMAGEERROR = 1;
104 * A single frame is complete but more will follow.
106 * @see #imageComplete
108 int SINGLEFRAMEDONE = 2;
111 * The image is complete and no more pixels or frames will follow.
113 * @see #imageComplete
115 int STATICIMAGEDONE = 3;
118 * Production of the image has been aborted.
120 * @see #imageComplete
122 int IMAGEABORTED = 4;
125 * An <code>ImageProducer</code> indicates the size of the image
126 * being produced using this method.
128 * @param width the width of the image
129 * @param height the height of the image
131 void setDimensions(int width, int height);
134 * An <code>ImageProducer</code> can set a list of properties
135 * associated with this image by using this method.
137 * @param props the list of properties associated with this image
139 void setProperties(Hashtable props);
142 * This <code>ColorModel</code> should indicate the model used by
143 * the majority of calls to <code>setPixels</code>. Each call to
144 * <code>setPixels</code> could however indicate a different
145 * <code>ColorModel</code>.
147 * @param model the color model to be used most often by setPixels
148 * @see ColorModel
150 void setColorModel(ColorModel model);
153 * The <code>ImageProducer</code> should call this method with a
154 * bit mask of hints from any of <code>RANDOMPIXELORDER</code>,
155 * <code>TOPDOWNLEFTRIGHT</code>, <code>COMPLETESCANLINES</code>,
156 * <code>SINGLEPASS</code>, <code>SINGLEFRAME</code>.
158 * @param flags a bit mask of hints
160 void setHints(int flags);
163 * Deliver a subset of an ImageProducer's pixels to this ImageConsumer.
165 * Each element of the pixels array represents one pixel. The
166 * pixel data is formatted according to the color model model.
167 * The x and y parameters are the coordinates of the block of
168 * pixels being delivered to this ImageConsumer. They are
169 * specified relative to the top left corner of the image being
170 * produced. Likewise, w and h are the pixel block's dimensions.
172 * @param x x coordinate of pixel block
173 * @param y y coordinate of pixel block
174 * @param w width of pixel block
175 * @param h height of pixel block
176 * @param model color model used to interpret pixel data
177 * @param pixels pixel block data
178 * @param offset offset into pixels array
179 * @param scansize width of one row in the pixel block
181 void setPixels(int x, int y, int w, int h,
182 ColorModel model, byte[] pixels, int offset, int scansize);
185 * Deliver a subset of an ImageProducer's pixels to this ImageConsumer.
187 * Each element of the pixels array represents one pixel. The
188 * pixel data is formatted according to the color model model.
189 * The x and y parameters are the coordinates of the rectangular
190 * region of pixels being delivered to this ImageConsumer,
191 * specified relative to the top left corner of the image being
192 * produced. Likewise, w and h are the pixel region's dimensions.
194 * @param x x coordinate of pixel block
195 * @param y y coordinate of pixel block
196 * @param w width of pixel block
197 * @param h height of pixel block
198 * @param model color model used to interpret pixel data
199 * @param pixels pixel block data
200 * @param offset offset into pixels array
201 * @param scansize width of one row in the pixel block
203 void setPixels(int x, int y, int w, int h,
204 ColorModel model, int[] pixels, int offset, int scansize);
207 * The <code>ImageProducer</code> calls this method to indicate a
208 * single frame or the entire image is complete. The method is
209 * also used to indicate an error in loading or producing the
210 * image.
212 * @param status the status of image production, represented by a
213 * bitwise OR of ImageConsumer flags
215 void imageComplete(int status);