| 1 |
771 |
jeremybenn |
/* ImageConsumer.java -- Java interface for image consumption
|
| 2 |
|
|
Copyright (C) 1999, 2003 Free Software Foundation, Inc.
|
| 3 |
|
|
|
| 4 |
|
|
This file is part of GNU Classpath.
|
| 5 |
|
|
|
| 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.
|
| 10 |
|
|
|
| 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.
|
| 15 |
|
|
|
| 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.
|
| 20 |
|
|
|
| 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.
|
| 25 |
|
|
|
| 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. */
|
| 37 |
|
|
|
| 38 |
|
|
|
| 39 |
|
|
package java.awt.image;
|
| 40 |
|
|
|
| 41 |
|
|
import java.util.Hashtable;
|
| 42 |
|
|
|
| 43 |
|
|
/**
|
| 44 |
|
|
* An object implementing the <code>ImageProducer</code> interface can
|
| 45 |
|
|
* use objects implementing this interface to deliver the image data.
|
| 46 |
|
|
*
|
| 47 |
|
|
* @author C. Brian Jones (cbj@gnu.org)
|
| 48 |
|
|
*/
|
| 49 |
|
|
public interface ImageConsumer
|
| 50 |
|
|
{
|
| 51 |
|
|
/**
|
| 52 |
|
|
* The pixel order may be random. This should be
|
| 53 |
|
|
* the default assumption of the <code>ImageConsumer</code>.
|
| 54 |
|
|
*
|
| 55 |
|
|
* @see #setHints
|
| 56 |
|
|
*/
|
| 57 |
|
|
int RANDOMPIXELORDER = 1;
|
| 58 |
|
|
|
| 59 |
|
|
/**
|
| 60 |
|
|
* The pixel order is top-down, left-right.
|
| 61 |
|
|
*
|
| 62 |
|
|
* @see #setHints
|
| 63 |
|
|
*/
|
| 64 |
|
|
int TOPDOWNLEFTRIGHT = 2;
|
| 65 |
|
|
|
| 66 |
|
|
/**
|
| 67 |
|
|
* The pixel order is in multiples of complete scanlines.
|
| 68 |
|
|
*
|
| 69 |
|
|
* @see #setHints
|
| 70 |
|
|
*/
|
| 71 |
|
|
int COMPLETESCANLINES = 4;
|
| 72 |
|
|
|
| 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.
|
| 76 |
|
|
*
|
| 77 |
|
|
* @see #setHints
|
| 78 |
|
|
* @see #setPixels(int, int, int, int, ColorModel, int[], int, int)
|
| 79 |
|
|
*/
|
| 80 |
|
|
int SINGLEPASS = 8;
|
| 81 |
|
|
|
| 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.
|
| 90 |
|
|
*
|
| 91 |
|
|
* @see #setHints
|
| 92 |
|
|
* @see #imageComplete
|
| 93 |
|
|
*/
|
| 94 |
|
|
int SINGLEFRAME = 16;
|
| 95 |
|
|
|
| 96 |
|
|
/**
|
| 97 |
|
|
* Indicates an error occurred while producing an image.
|
| 98 |
|
|
*
|
| 99 |
|
|
* @see #imageComplete
|
| 100 |
|
|
*/
|
| 101 |
|
|
int IMAGEERROR = 1;
|
| 102 |
|
|
|
| 103 |
|
|
/**
|
| 104 |
|
|
* A single frame is complete but more will follow.
|
| 105 |
|
|
*
|
| 106 |
|
|
* @see #imageComplete
|
| 107 |
|
|
*/
|
| 108 |
|
|
int SINGLEFRAMEDONE = 2;
|
| 109 |
|
|
|
| 110 |
|
|
/**
|
| 111 |
|
|
* The image is complete and no more pixels or frames will follow.
|
| 112 |
|
|
*
|
| 113 |
|
|
* @see #imageComplete
|
| 114 |
|
|
*/
|
| 115 |
|
|
int STATICIMAGEDONE = 3;
|
| 116 |
|
|
|
| 117 |
|
|
/**
|
| 118 |
|
|
* Production of the image has been aborted.
|
| 119 |
|
|
*
|
| 120 |
|
|
* @see #imageComplete
|
| 121 |
|
|
*/
|
| 122 |
|
|
int IMAGEABORTED = 4;
|
| 123 |
|
|
|
| 124 |
|
|
/**
|
| 125 |
|
|
* An <code>ImageProducer</code> indicates the size of the image
|
| 126 |
|
|
* being produced using this method.
|
| 127 |
|
|
*
|
| 128 |
|
|
* @param width the width of the image
|
| 129 |
|
|
* @param height the height of the image
|
| 130 |
|
|
*/
|
| 131 |
|
|
void setDimensions(int width, int height);
|
| 132 |
|
|
|
| 133 |
|
|
/**
|
| 134 |
|
|
* An <code>ImageProducer</code> can set a list of properties
|
| 135 |
|
|
* associated with this image by using this method.
|
| 136 |
|
|
*
|
| 137 |
|
|
* @param props the list of properties associated with this image
|
| 138 |
|
|
*/
|
| 139 |
|
|
void setProperties(Hashtable<?,?> props);
|
| 140 |
|
|
|
| 141 |
|
|
/**
|
| 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>.
|
| 146 |
|
|
*
|
| 147 |
|
|
* @param model the color model to be used most often by setPixels
|
| 148 |
|
|
* @see ColorModel
|
| 149 |
|
|
*/
|
| 150 |
|
|
void setColorModel(ColorModel model);
|
| 151 |
|
|
|
| 152 |
|
|
/**
|
| 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>.
|
| 157 |
|
|
*
|
| 158 |
|
|
* @param flags a bit mask of hints
|
| 159 |
|
|
*/
|
| 160 |
|
|
void setHints(int flags);
|
| 161 |
|
|
|
| 162 |
|
|
/**
|
| 163 |
|
|
* Deliver a subset of an ImageProducer's pixels to this ImageConsumer.
|
| 164 |
|
|
*
|
| 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.
|
| 171 |
|
|
*
|
| 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
|
| 180 |
|
|
*/
|
| 181 |
|
|
void setPixels(int x, int y, int w, int h,
|
| 182 |
|
|
ColorModel model, byte[] pixels, int offset, int scansize);
|
| 183 |
|
|
|
| 184 |
|
|
/**
|
| 185 |
|
|
* Deliver a subset of an ImageProducer's pixels to this ImageConsumer.
|
| 186 |
|
|
*
|
| 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.
|
| 193 |
|
|
*
|
| 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
|
| 202 |
|
|
*/
|
| 203 |
|
|
void setPixels(int x, int y, int w, int h,
|
| 204 |
|
|
ColorModel model, int[] pixels, int offset, int scansize);
|
| 205 |
|
|
|
| 206 |
|
|
/**
|
| 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.
|
| 211 |
|
|
*
|
| 212 |
|
|
* @param status the status of image production, represented by a
|
| 213 |
|
|
* bitwise OR of ImageConsumer flags
|
| 214 |
|
|
*/
|
| 215 |
|
|
void imageComplete(int status);
|
| 216 |
|
|
}
|