1 /*
2 * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
206 pixelscan = scan;
207 if (props == null) {
208 props = new Hashtable<>();
209 }
210 properties = props;
211 }
212
213 /**
214 * Constructs an ImageProducer object which uses an array of integers
215 * in the default RGB ColorModel to produce data for an Image object.
216 * @param w the width of the rectangle of pixels
217 * @param h the height of the rectangle of pixels
218 * @param pix an array of pixels
219 * @param off the offset into the array of where to store the
220 * first pixel
221 * @param scan the distance from one row of pixels to the next in
222 * the array
223 * @see java.awt.Component#createImage
224 * @see ColorModel#getRGBdefault
225 */
226 public MemoryImageSource(int w, int h, int pix[], int off, int scan) {
227 initialize(w, h, ColorModel.getRGBdefault(),
228 (Object) pix, off, scan, null);
229 }
230
231 /**
232 * Constructs an ImageProducer object which uses an array of integers
233 * in the default RGB ColorModel to produce data for an Image object.
234 * @param w the width of the rectangle of pixels
235 * @param h the height of the rectangle of pixels
236 * @param pix an array of pixels
237 * @param off the offset into the array of where to store the
238 * first pixel
239 * @param scan the distance from one row of pixels to the next in
240 * the array
241 * @param props a list of properties that the {@code ImageProducer}
242 * uses to process an image
243 * @see java.awt.Component#createImage
244 * @see ColorModel#getRGBdefault
245 */
246 public MemoryImageSource(int w, int h, int pix[], int off, int scan,
247 Hashtable<?,?> props)
248 {
249 initialize(w, h, ColorModel.getRGBdefault(),
250 (Object) pix, off, scan, props);
251 }
252
253 /**
254 * Adds an ImageConsumer to the list of consumers interested in
255 * data for this image.
256 * @param ic the specified {@code ImageConsumer}
257 * @throws NullPointerException if the specified
258 * {@code ImageConsumer} is null
259 * @see ImageConsumer
260 */
261 public synchronized void addConsumer(ImageConsumer ic) {
262 if (theConsumers.contains(ic)) {
263 return;
264 }
265 theConsumers.addElement(ic);
266 try {
|
1 /*
2 * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
206 pixelscan = scan;
207 if (props == null) {
208 props = new Hashtable<>();
209 }
210 properties = props;
211 }
212
213 /**
214 * Constructs an ImageProducer object which uses an array of integers
215 * in the default RGB ColorModel to produce data for an Image object.
216 * @param w the width of the rectangle of pixels
217 * @param h the height of the rectangle of pixels
218 * @param pix an array of pixels
219 * @param off the offset into the array of where to store the
220 * first pixel
221 * @param scan the distance from one row of pixels to the next in
222 * the array
223 * @see java.awt.Component#createImage
224 * @see ColorModel#getRGBdefault
225 */
226 public MemoryImageSource(int w, int h, int[] pix, int off, int scan) {
227 initialize(w, h, ColorModel.getRGBdefault(),
228 (Object) pix, off, scan, null);
229 }
230
231 /**
232 * Constructs an ImageProducer object which uses an array of integers
233 * in the default RGB ColorModel to produce data for an Image object.
234 * @param w the width of the rectangle of pixels
235 * @param h the height of the rectangle of pixels
236 * @param pix an array of pixels
237 * @param off the offset into the array of where to store the
238 * first pixel
239 * @param scan the distance from one row of pixels to the next in
240 * the array
241 * @param props a list of properties that the {@code ImageProducer}
242 * uses to process an image
243 * @see java.awt.Component#createImage
244 * @see ColorModel#getRGBdefault
245 */
246 public MemoryImageSource(int w, int h, int[] pix, int off, int scan,
247 Hashtable<?,?> props)
248 {
249 initialize(w, h, ColorModel.getRGBdefault(),
250 (Object) pix, off, scan, props);
251 }
252
253 /**
254 * Adds an ImageConsumer to the list of consumers interested in
255 * data for this image.
256 * @param ic the specified {@code ImageConsumer}
257 * @throws NullPointerException if the specified
258 * {@code ImageConsumer} is null
259 * @see ImageConsumer
260 */
261 public synchronized void addConsumer(ImageConsumer ic) {
262 if (theConsumers.contains(ic)) {
263 return;
264 }
265 theConsumers.addElement(ic);
266 try {
|