1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 /** 18 * @author Igor V. Stolyarov 19 * @version $Revision$ 20 */ 21 22 package java.awt.image; 23 24 import java.util.Hashtable; 25 26 /** 27 * The ImageConsumer interface provides the data about the image and about how 28 * its data is delivered. A ImageProducer provides all of the information about 29 * the image using the methods defined in this interface. 30 * 31 * @since Android 1.0 32 */ 33 public interface ImageConsumer { 34 35 /** 36 * The Constant RANDOMPIXELORDER indicates that the pixels are delivered in 37 * a random order. 38 */ 39 public static final int RANDOMPIXELORDER = 1; 40 41 /** 42 * The Constant TOPDOWNLEFTRIGHT indicates that the pixels are delivered in 43 * top-down, left-to-right order. 44 */ 45 public static final int TOPDOWNLEFTRIGHT = 2; 46 47 /** 48 * The Constant COMPLETESCANLINES indicates that the pixels are delivered in 49 * complete scanline. 50 */ 51 public static final int COMPLETESCANLINES = 4; 52 53 /** 54 * The Constant SINGLEPASS indicates that pixels are delivered in a single 55 * pass. 56 */ 57 public static final int SINGLEPASS = 8; 58 59 /** 60 * The Constant SINGLEFRAME indicates that image consists of single frame. 61 */ 62 public static final int SINGLEFRAME = 16; 63 64 /** 65 * The Constant IMAGEERROR indicates an image error during image producing. 66 */ 67 public static final int IMAGEERROR = 1; 68 69 /** 70 * The Constant SINGLEFRAMEDONE indicates that only one of the image's 71 * frames is completed. 72 */ 73 public static final int SINGLEFRAMEDONE = 2; 74 75 /** 76 * The Constant STATICIMAGEDONE indicates that the image is completed. 77 */ 78 public static final int STATICIMAGEDONE = 3; 79 80 /** 81 * The Constant IMAGEABORTED indicates that the image producing process is 82 * aborted. 83 */ 84 public static final int IMAGEABORTED = 4; 85 86 /** 87 * Sets the properties for the image associated with this ImageConsumer. 88 * 89 * @param props 90 * the properties for the image associated with this 91 * ImageConsumer. 92 */ 93 public void setProperties(Hashtable<?, ?> props); 94 95 /** 96 * Sets the ColorModel object. 97 * 98 * @param model 99 * the new ColorModel. 100 */ 101 public void setColorModel(ColorModel model); 102 103 /** 104 * Sets the pixels for the specified rectangular area of the image. 105 * 106 * @param x 107 * the X coordinate of rectangular area. 108 * @param y 109 * the Y coordinate of rectangular area. 110 * @param w 111 * the width of rectangular area. 112 * @param h 113 * the height of rectangular area. 114 * @param model 115 * the specified ColorModel to be used for pixels converting. 116 * @param pixels 117 * the array of pixels. 118 * @param off 119 * the offset of pixels array. 120 * @param scansize 121 * the distance from the one row of pixels to the next row in the 122 * specified array. 123 */ 124 public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, 125 int scansize); 126 127 /** 128 * Sets the pixels for the specified rectangular area of the image. 129 * 130 * @param x 131 * the X coordinate of rectangular area. 132 * @param y 133 * the Y coordinate of rectangular area. 134 * @param w 135 * the width of rectangular area. 136 * @param h 137 * the height of rectangular area. 138 * @param model 139 * the specified ColorModel to be used for pixels converting. 140 * @param pixels 141 * the array of pixels. 142 * @param off 143 * the offset of pixels array. 144 * @param scansize 145 * the distance from the one row of pixels to the next row in the 146 * specified array. 147 */ 148 public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, 149 int scansize); 150 151 /** 152 * Sets the dimensions of a source image. 153 * 154 * @param width 155 * the width of the image. 156 * @param height 157 * the height of the image. 158 */ 159 public void setDimensions(int width, int height); 160 161 /** 162 * Sets the hint flags of pixels order, which is used by the ImageConsumer 163 * for obtaining pixels from the ImageProducer for which this ImageConsumer 164 * is added. 165 * 166 * @param hintflags 167 * the mask of hint flags. 168 */ 169 public void setHints(int hintflags); 170 171 /** 172 * THis method is called in the one of the following cases: 173 * <ul> 174 * <li>The ImageProducer (for which this ImageConsumer is added) has been 175 * delivered all pixels of the source image.</li> 176 * <li>A one frame of an animation has been completed.</li> 177 * <li>An error while loading or producing of the image has occurred. 178 * </ul> 179 * 180 * @param status 181 * the status of image producing. 182 */ 183 public void imageComplete(int status); 184 185 } 186