J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1995-2000 Sun Microsystems, Inc. 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. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | package java.awt.image; |
| 27 | |
| 28 | /** |
| 29 | * The interface for objects which can produce the image data for Images. |
| 30 | * Each image contains an ImageProducer which is used to reconstruct |
| 31 | * the image whenever it is needed, for example, when a new size of the |
| 32 | * Image is scaled, or when the width or height of the Image is being |
| 33 | * requested. |
| 34 | * |
| 35 | * @see ImageConsumer |
| 36 | * |
| 37 | * @author Jim Graham |
| 38 | */ |
| 39 | public interface ImageProducer { |
| 40 | /** |
| 41 | * Registers an <code>ImageConsumer</code> with the |
| 42 | * <code>ImageProducer</code> for access to the image data |
| 43 | * during a later reconstruction of the <code>Image</code>. |
| 44 | * The <code>ImageProducer</code> may, at its discretion, |
| 45 | * start delivering the image data to the consumer |
| 46 | * using the <code>ImageConsumer</code> interface immediately, |
| 47 | * or when the next available image reconstruction is triggered |
| 48 | * by a call to the <code>startProduction</code> method. |
| 49 | * @param ic the specified <code>ImageConsumer</code> |
| 50 | * @see #startProduction |
| 51 | */ |
| 52 | public void addConsumer(ImageConsumer ic); |
| 53 | |
| 54 | /** |
| 55 | * Determines if a specified <code>ImageConsumer</code> |
| 56 | * object is currently registered with this |
| 57 | * <code>ImageProducer</code> as one of its consumers. |
| 58 | * @param ic the specified <code>ImageConsumer</code> |
| 59 | * @return <code>true</code> if the specified |
| 60 | * <code>ImageConsumer</code> is registered with |
| 61 | * this <code>ImageProducer</code>; |
| 62 | * <code>false</code> otherwise. |
| 63 | */ |
| 64 | public boolean isConsumer(ImageConsumer ic); |
| 65 | |
| 66 | /** |
| 67 | * Removes the specified <code>ImageConsumer</code> object |
| 68 | * from the list of consumers currently registered to |
| 69 | * receive image data. It is not considered an error |
| 70 | * to remove a consumer that is not currently registered. |
| 71 | * The <code>ImageProducer</code> should stop sending data |
| 72 | * to this consumer as soon as is feasible. |
| 73 | * @param ic the specified <code>ImageConsumer</code> |
| 74 | */ |
| 75 | public void removeConsumer(ImageConsumer ic); |
| 76 | |
| 77 | /** |
| 78 | * Registers the specified <code>ImageConsumer</code> object |
| 79 | * as a consumer and starts an immediate reconstruction of |
| 80 | * the image data which will then be delivered to this |
| 81 | * consumer and any other consumer which might have already |
| 82 | * been registered with the producer. This method differs |
| 83 | * from the addConsumer method in that a reproduction of |
| 84 | * the image data should be triggered as soon as possible. |
| 85 | * @param ic the specified <code>ImageConsumer</code> |
| 86 | * @see #addConsumer |
| 87 | */ |
| 88 | public void startProduction(ImageConsumer ic); |
| 89 | |
| 90 | /** |
| 91 | * Requests, on behalf of the <code>ImageConsumer</code>, |
| 92 | * that the <code>ImageProducer</code> attempt to resend |
| 93 | * the image data one more time in TOPDOWNLEFTRIGHT order |
| 94 | * so that higher quality conversion algorithms which |
| 95 | * depend on receiving pixels in order can be used to |
| 96 | * produce a better output version of the image. The |
| 97 | * <code>ImageProducer</code> is free to |
| 98 | * ignore this call if it cannot resend the data in that |
| 99 | * order. If the data can be resent, the |
| 100 | * <code>ImageProducer</code> should respond by executing |
| 101 | * the following minimum set of <code>ImageConsumer</code> |
| 102 | * method calls: |
| 103 | * <pre> |
| 104 | * ic.setHints(TOPDOWNLEFTRIGHT | < otherhints >); |
| 105 | * ic.setPixels(...); // As many times as needed |
| 106 | * ic.imageComplete(); |
| 107 | * </pre> |
| 108 | * @param ic the specified <code>ImageConsumer</code> |
| 109 | * @see ImageConsumer#setHints |
| 110 | */ |
| 111 | public void requestTopDownLeftRightResend(ImageConsumer ic); |
| 112 | } |