< prev index next >

src/java.desktop/share/classes/java/awt/image/ImageProducer.java

Print this page




  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
  23  * 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>{@code
 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 }


  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
  23  * 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} with the
  42      * {@code ImageProducer} for access to the image data
  43      * during a later reconstruction of the {@code Image}.
  44      * The {@code ImageProducer} may, at its discretion,
  45      * start delivering the image data to the consumer
  46      * using the {@code ImageConsumer} interface immediately,
  47      * or when the next available image reconstruction is triggered
  48      * by a call to the {@code startProduction} method.
  49      * @param ic the specified {@code ImageConsumer}
  50      * @see #startProduction
  51      */
  52     public void addConsumer(ImageConsumer ic);
  53 
  54     /**
  55      * Determines if a specified {@code ImageConsumer}
  56      * object is currently registered with this
  57      * {@code ImageProducer} as one of its consumers.
  58      * @param ic the specified {@code ImageConsumer}
  59      * @return {@code true} if the specified
  60      *         {@code ImageConsumer} is registered with
  61      *         this {@code ImageProducer};
  62      *         {@code false} otherwise.
  63      */
  64     public boolean isConsumer(ImageConsumer ic);
  65 
  66     /**
  67      * Removes the specified {@code ImageConsumer} 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} should stop sending data
  72      * to this consumer as soon as is feasible.
  73      * @param ic the specified {@code ImageConsumer}
  74      */
  75     public void removeConsumer(ImageConsumer ic);
  76 
  77     /**
  78      * Registers the specified {@code ImageConsumer} 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}
  86      * @see #addConsumer
  87      */
  88     public void startProduction(ImageConsumer ic);
  89 
  90     /**
  91      * Requests, on behalf of the {@code ImageConsumer},
  92      * that the {@code ImageProducer} 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} 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} should respond by executing
 101      * the following minimum set of {@code ImageConsumer}
 102      * method calls:
 103      * <pre>{@code
 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}
 109      * @see ImageConsumer#setHints
 110      */
 111     public void requestTopDownLeftRightResend(ImageConsumer ic);
 112 }
< prev index next >