home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / java.z / ImageProducer.java < prev    next >
Text File  |  1996-05-03  |  4KB  |  96 lines

  1. /*
  2.  * @(#)ImageProducer.java    1.10 95/12/14 Jim Graham
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package java.awt.image;
  21.  
  22. /**
  23.  * The interface for objects which can produce the image data for Images.
  24.  * Each image contains an ImageProducer which is used to reconstruct
  25.  * the image whenever it is needed, for example, when a new size of the
  26.  * Image is scaled, or when the width or height of the Image is being
  27.  * requested.
  28.  *
  29.  * @see ImageConsumer
  30.  *
  31.  * @version    1.10 14 Dec 1995
  32.  * @author     Jim Graham
  33.  */
  34. public interface ImageProducer {
  35.     /**
  36.      * This method is used to register an ImageConsumer with the
  37.      * ImageProducer for access to the image data during a later
  38.      * reconstruction of the Image.  The ImageProducer may, at its
  39.      * discretion, start delivering the image data to the consumer
  40.      * using the ImageConsumer interface immediately, or when the
  41.      * next available image reconstruction is triggered by a call
  42.      * to the startProduction method.
  43.      * @see #startProduction
  44.      */
  45.     public void addConsumer(ImageConsumer ic);
  46.  
  47.     /**
  48.      * This method determines if a given ImageConsumer object
  49.      * is currently registered with this ImageProducer as one
  50.      * of its consumers.
  51.      */
  52.     public boolean isConsumer(ImageConsumer ic);
  53.  
  54.     /**
  55.      * This method removes the given ImageConsumer object
  56.      * from the list of consumers currently registered to
  57.      * receive image data.  It is not considered an error
  58.      * to remove a consumer that is not currently registered.
  59.      * The ImageProducer should stop sending data to this
  60.      * consumer as soon as is feasible.
  61.      */
  62.     public void removeConsumer(ImageConsumer ic);
  63.  
  64.     /**
  65.      * This method both registers the given ImageConsumer object
  66.      * as a consumer and starts an immediate reconstruction of
  67.      * the image data which will then be delivered to this
  68.      * consumer and any other consumer which may have already
  69.      * been registered with the producer.  This method differs
  70.      * from the addConsumer method in that a reproduction of
  71.      * the image data should be triggered as soon as possible.
  72.      * @see #addConsumer
  73.      */
  74.     public void startProduction(ImageConsumer ic);
  75.  
  76.     /**
  77.      * This method is used by an ImageConsumer to request that
  78.      * the ImageProducer attempt to resend the image data one
  79.      * more time in TOPDOWNLEFTRIGHT order so that higher
  80.      * quality conversion algorithms which depend on receiving
  81.      * pixels in order can be used to produce a better output
  82.      * version of the image.  The ImageProducer is free to
  83.      * ignore this call if it cannot resend the data in that
  84.      * order.  If the data can be resent, then the ImageProducer
  85.      * should respond by executing the following minimum set of
  86.      * ImageConsumer method calls:
  87.      * <pre>
  88.      *    ic.setHints(TOPDOWNLEFTRIGHT | < otherhints >);
  89.      *    ic.setPixels(...);    // As many times as needed
  90.      *    ic.imageComplete();
  91.      * </pre>
  92.      * @see ImageConsumer#setHints
  93.      */
  94.     public void requestTopDownLeftRightResend(ImageConsumer ic);
  95. }
  96.