0N/A/*
2362N/A * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.awt.image;
0N/A
0N/Aimport java.util.Hashtable;
0N/A
0N/A/**
0N/A * The interface for objects expressing interest in image data through
0N/A * the ImageProducer interfaces. When a consumer is added to an image
0N/A * producer, the producer delivers all of the data about the image
0N/A * using the method calls defined in this interface.
0N/A *
0N/A * @see ImageProducer
0N/A *
0N/A * @author Jim Graham
0N/A */
0N/Apublic interface ImageConsumer {
0N/A /**
0N/A * The dimensions of the source image are reported using the
0N/A * setDimensions method call.
0N/A * @param width the width of the source image
0N/A * @param height the height of the source image
0N/A */
0N/A void setDimensions(int width, int height);
0N/A
0N/A /**
0N/A * Sets the extensible list of properties associated with this image.
0N/A * @param props the list of properties to be associated with this
0N/A * image
0N/A */
0N/A void setProperties(Hashtable<?,?> props);
0N/A
0N/A /**
0N/A * Sets the ColorModel object used for the majority of
0N/A * the pixels reported using the setPixels method
0N/A * calls. Note that each set of pixels delivered using setPixels
0N/A * contains its own ColorModel object, so no assumption should
0N/A * be made that this model will be the only one used in delivering
0N/A * pixel values. A notable case where multiple ColorModel objects
0N/A * may be seen is a filtered image when for each set of pixels
0N/A * that it filters, the filter
0N/A * determines whether the
0N/A * pixels can be sent on untouched, using the original ColorModel,
0N/A * or whether the pixels should be modified (filtered) and passed
0N/A * on using a ColorModel more convenient for the filtering process.
0N/A * @param model the specified <code>ColorModel</code>
0N/A * @see ColorModel
0N/A */
0N/A void setColorModel(ColorModel model);
0N/A
0N/A /**
0N/A * Sets the hints that the ImageConsumer uses to process the
0N/A * pixels delivered by the ImageProducer.
0N/A * The ImageProducer can deliver the pixels in any order, but
0N/A * the ImageConsumer may be able to scale or convert the pixels
0N/A * to the destination ColorModel more efficiently or with higher
0N/A * quality if it knows some information about how the pixels will
0N/A * be delivered up front. The setHints method should be called
0N/A * before any calls to any of the setPixels methods with a bit mask
0N/A * of hints about the manner in which the pixels will be delivered.
0N/A * If the ImageProducer does not follow the guidelines for the
0N/A * indicated hint, the results are undefined.
0N/A * @param hintflags a set of hints that the ImageConsumer uses to
0N/A * process the pixels
0N/A */
0N/A void setHints(int hintflags);
0N/A
0N/A /**
0N/A * The pixels will be delivered in a random order. This tells the
0N/A * ImageConsumer not to use any optimizations that depend on the
0N/A * order of pixel delivery, which should be the default assumption
0N/A * in the absence of any call to the setHints method.
0N/A * @see #setHints
0N/A */
0N/A int RANDOMPIXELORDER = 1;
0N/A
0N/A /**
0N/A * The pixels will be delivered in top-down, left-to-right order.
0N/A * @see #setHints
0N/A */
0N/A int TOPDOWNLEFTRIGHT = 2;
0N/A
0N/A /**
0N/A * The pixels will be delivered in (multiples of) complete scanlines
0N/A * at a time.
0N/A * @see #setHints
0N/A */
0N/A int COMPLETESCANLINES = 4;
0N/A
0N/A /**
0N/A * The pixels will be delivered in a single pass. Each pixel will
0N/A * appear in only one call to any of the setPixels methods. An
0N/A * example of an image format which does not meet this criterion
0N/A * is a progressive JPEG image which defines pixels in multiple
0N/A * passes, each more refined than the previous.
0N/A * @see #setHints
0N/A */
0N/A int SINGLEPASS = 8;
0N/A
0N/A /**
0N/A * The image contain a single static image. The pixels will be defined
0N/A * in calls to the setPixels methods and then the imageComplete method
0N/A * will be called with the STATICIMAGEDONE flag after which no more
0N/A * image data will be delivered. An example of an image type which
0N/A * would not meet these criteria would be the output of a video feed,
0N/A * or the representation of a 3D rendering being manipulated
0N/A * by the user. The end of each frame in those types of images will
0N/A * be indicated by calling imageComplete with the SINGLEFRAMEDONE flag.
0N/A * @see #setHints
0N/A * @see #imageComplete
0N/A */
0N/A int SINGLEFRAME = 16;
0N/A
0N/A /**
0N/A * Delivers the pixels of the image with one or more calls
0N/A * to this method. Each call specifies the location and
0N/A * size of the rectangle of source pixels that are contained in
0N/A * the array of pixels. The specified ColorModel object should
0N/A * be used to convert the pixels into their corresponding color
0N/A * and alpha components. Pixel (m,n) is stored in the pixels array
0N/A * at index (n * scansize + m + off). The pixels delivered using
0N/A * this method are all stored as bytes.
0N/A * @param x the X coordinate of the upper-left corner of the
0N/A * area of pixels to be set
0N/A * @param y the Y coordinate of the upper-left corner of the
0N/A * area of pixels to be set
0N/A * @param w the width of the area of pixels
0N/A * @param h the height of the area of pixels
0N/A * @param model the specified <code>ColorModel</code>
0N/A * @param pixels the array of pixels
0N/A * @param off the offset into the <code>pixels</code> array
0N/A * @param scansize the distance from one row of pixels to the next in
0N/A * the <code>pixels</code> array
0N/A * @see ColorModel
0N/A */
0N/A void setPixels(int x, int y, int w, int h,
0N/A ColorModel model, byte pixels[], int off, int scansize);
0N/A
0N/A /**
0N/A * The pixels of the image are delivered using one or more calls
0N/A * to the setPixels method. Each call specifies the location and
0N/A * size of the rectangle of source pixels that are contained in
0N/A * the array of pixels. The specified ColorModel object should
0N/A * be used to convert the pixels into their corresponding color
0N/A * and alpha components. Pixel (m,n) is stored in the pixels array
0N/A * at index (n * scansize + m + off). The pixels delivered using
0N/A * this method are all stored as ints.
0N/A * this method are all stored as ints.
0N/A * @param x the X coordinate of the upper-left corner of the
0N/A * area of pixels to be set
0N/A * @param y the Y coordinate of the upper-left corner of the
0N/A * area of pixels to be set
0N/A * @param w the width of the area of pixels
0N/A * @param h the height of the area of pixels
0N/A * @param model the specified <code>ColorModel</code>
0N/A * @param pixels the array of pixels
0N/A * @param off the offset into the <code>pixels</code> array
0N/A * @param scansize the distance from one row of pixels to the next in
0N/A * the <code>pixels</code> array
0N/A * @see ColorModel
0N/A */
0N/A void setPixels(int x, int y, int w, int h,
0N/A ColorModel model, int pixels[], int off, int scansize);
0N/A
0N/A /**
0N/A * The imageComplete method is called when the ImageProducer is
0N/A * finished delivering all of the pixels that the source image
0N/A * contains, or when a single frame of a multi-frame animation has
0N/A * been completed, or when an error in loading or producing the
0N/A * image has occured. The ImageConsumer should remove itself from the
0N/A * list of consumers registered with the ImageProducer at this time,
0N/A * unless it is interested in successive frames.
0N/A * @param status the status of image loading
0N/A * @see ImageProducer#removeConsumer
0N/A */
0N/A void imageComplete(int status);
0N/A
0N/A /**
0N/A * An error was encountered while producing the image.
0N/A * @see #imageComplete
0N/A */
0N/A int IMAGEERROR = 1;
0N/A
0N/A /**
0N/A * One frame of the image is complete but there are more frames
0N/A * to be delivered.
0N/A * @see #imageComplete
0N/A */
0N/A int SINGLEFRAMEDONE = 2;
0N/A
0N/A /**
0N/A * The image is complete and there are no more pixels or frames
0N/A * to be delivered.
0N/A * @see #imageComplete
0N/A */
0N/A int STATICIMAGEDONE = 3;
0N/A
0N/A /**
0N/A * The image creation process was deliberately aborted.
0N/A * @see #imageComplete
0N/A */
0N/A int IMAGEABORTED = 4;
0N/A}