KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > image > ImageProducer


1 /*
2  * @(#)ImageProducer.java 1.20 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt.image;
9
10 /**
11  * The interface for objects which can produce the image data for Images.
12  * Each image contains an ImageProducer which is used to reconstruct
13  * the image whenever it is needed, for example, when a new size of the
14  * Image is scaled, or when the width or height of the Image is being
15  * requested.
16  *
17  * @see ImageConsumer
18  *
19  * @version 1.20 12/19/03
20  * @author Jim Graham
21  */

22 public interface ImageProducer {
23     /**
24      * Registers an <code>ImageConsumer</code> with the
25      * <code>ImageProducer</code> for access to the image data
26      * during a later reconstruction of the <code>Image</code>.
27      * The <code>ImageProducer</code> may, at its discretion,
28      * start delivering the image data to the consumer
29      * using the <code>ImageConsumer</code> interface immediately,
30      * or when the next available image reconstruction is triggered
31      * by a call to the <code>startProduction</code> method.
32      * @param ic the specified <code>ImageConsumer</code>
33      * @see #startProduction
34      */

35     public void addConsumer(ImageConsumer JavaDoc ic);
36
37     /**
38      * Determines if a specified <code>ImageConsumer</code>
39      * object is currently registered with this
40      * <code>ImageProducer</code> as one of its consumers.
41      * @param ic the specified <code>ImageConsumer</code>
42      * @return <code>true</code> if the specified
43      * <code>ImageConsumer</code> is registered with
44      * this <code>ImageProducer</code>;
45      * <code>false</code> otherwise.
46      */

47     public boolean isConsumer(ImageConsumer JavaDoc ic);
48
49     /**
50      * Removes the specified <code>ImageConsumer</code> object
51      * from the list of consumers currently registered to
52      * receive image data. It is not considered an error
53      * to remove a consumer that is not currently registered.
54      * The <code>ImageProducer</code> should stop sending data
55      * to this consumer as soon as is feasible.
56      * @param ic the specified <code>ImageConsumer</code>
57      */

58     public void removeConsumer(ImageConsumer JavaDoc ic);
59
60     /**
61      * Registers the specified <code>ImageConsumer</code> object
62      * as a consumer and starts an immediate reconstruction of
63      * the image data which will then be delivered to this
64      * consumer and any other consumer which might have already
65      * been registered with the producer. This method differs
66      * from the addConsumer method in that a reproduction of
67      * the image data should be triggered as soon as possible.
68      * @param ic the specified <code>ImageConsumer</code>
69      * @see #addConsumer
70      */

71     public void startProduction(ImageConsumer JavaDoc ic);
72
73     /**
74      * Requests, on behalf of the <code>ImageConsumer</code>,
75      * that the <code>ImageProducer</code> attempt to resend
76      * the image data one more time in TOPDOWNLEFTRIGHT order
77      * so that higher quality conversion algorithms which
78      * depend on receiving pixels in order can be used to
79      * produce a better output version of the image. The
80      * <code>ImageProducer</code> is free to
81      * ignore this call if it cannot resend the data in that
82      * order. If the data can be resent, the
83      * <code>ImageProducer</code> should respond by executing
84      * the following minimum set of <code>ImageConsumer</code>
85      * method calls:
86      * <pre>
87      * ic.setHints(TOPDOWNLEFTRIGHT | < otherhints >);
88      * ic.setPixels(...); // As many times as needed
89      * ic.imageComplete();
90      * </pre>
91      * @param ic the specified <code>ImageConsumer</code>
92      * @see ImageConsumer#setHints
93      */

94     public void requestTopDownLeftRightResend(ImageConsumer JavaDoc ic);
95 }
96
Popular Tags