1 | /* ImageConsumer.java -- Java interface for image consumption
|
---|
2 | Copyright (C) 1999 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., 59 Temple Place, Suite 330, Boston, MA
|
---|
19 | 02111-1307 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 | public static final int RANDOMPIXELORDER = 1;
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * The pixel order is top-down, left-right.
|
---|
61 | *
|
---|
62 | * @see #setHints
|
---|
63 | */
|
---|
64 | public static final int TOPDOWNLEFTRIGHT = 2;
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * The pixel order is in multiples of complete scanlines.
|
---|
68 | *
|
---|
69 | * @see #setHints
|
---|
70 | */
|
---|
71 | public static final 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
|
---|
79 | */
|
---|
80 | public static final 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 | public static final int SINGLEFRAME = 16;
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * Indicates an error occurred while producing an image.
|
---|
98 | *
|
---|
99 | * @see #imageComplete
|
---|
100 | */
|
---|
101 | public static final int IMAGEERROR = 1;
|
---|
102 |
|
---|
103 | /**
|
---|
104 | * A single frame is complete but more will follow.
|
---|
105 | *
|
---|
106 | * @see #imageComplete
|
---|
107 | */
|
---|
108 | public static final int SINGLEFRAMEDONE = 2;
|
---|
109 |
|
---|
110 | /**
|
---|
111 | * The image is complete and no more pixels or frames will follow.
|
---|
112 | *
|
---|
113 | * @see #imageComplete
|
---|
114 | */
|
---|
115 | public static final int STATICIMAGEDONE = 3;
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Production of the image has been aborted.
|
---|
119 | *
|
---|
120 | * @see #imageComplete
|
---|
121 | */
|
---|
122 | public static final 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 | public abstract 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 | public abstract 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 | public abstract 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 | public abstract void setHints(int flags);
|
---|
161 |
|
---|
162 | /**
|
---|
163 | * This function delivers a rectangle of pixels where any
|
---|
164 | * pixel(m,n) is stored in the array as a <code>byte</code> at
|
---|
165 | * index (n * scansize + m + offset).
|
---|
166 | */
|
---|
167 | public abstract void setPixels(int x, int y, int w, int h,
|
---|
168 | ColorModel model, byte[] pixels, int offset, int scansize);
|
---|
169 |
|
---|
170 | /**
|
---|
171 | * This function delivers a rectangle of pixels where any
|
---|
172 | * pixel(m,n) is stored in the array as an <code>int</code> at
|
---|
173 | * index (n * scansize + m + offset).
|
---|
174 | */
|
---|
175 | public abstract void setPixels(int x, int y, int w, int h,
|
---|
176 | ColorModel model, int[] pixels, int offset, int scansize);
|
---|
177 |
|
---|
178 | /**
|
---|
179 | * The <code>ImageProducer</code> calls this method to indicate a
|
---|
180 | * single frame or the entire image is complete. The method is
|
---|
181 | * also used to indicate an error in loading or producing the
|
---|
182 | * image.
|
---|
183 | */
|
---|
184 | public abstract void imageComplete(int status);
|
---|
185 | }
|
---|
186 |
|
---|