1. /*
  2. * @(#)ImageProducer.java 1.15 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt.image;
  8. /**
  9. * The interface for objects which can produce the image data for Images.
  10. * Each image contains an ImageProducer which is used to reconstruct
  11. * the image whenever it is needed, for example, when a new size of the
  12. * Image is scaled, or when the width or height of the Image is being
  13. * requested.
  14. *
  15. * @see ImageConsumer
  16. *
  17. * @version 1.15 11/29/01
  18. * @author Jim Graham
  19. */
  20. public interface ImageProducer {
  21. /**
  22. * This method is used to register an ImageConsumer with the
  23. * ImageProducer for access to the image data during a later
  24. * reconstruction of the Image. The ImageProducer may, at its
  25. * discretion, start delivering the image data to the consumer
  26. * using the ImageConsumer interface immediately, or when the
  27. * next available image reconstruction is triggered by a call
  28. * to the startProduction method.
  29. * @see #startProduction
  30. */
  31. public void addConsumer(ImageConsumer ic);
  32. /**
  33. * This method determines if a given ImageConsumer object
  34. * is currently registered with this ImageProducer as one
  35. * of its consumers.
  36. */
  37. public boolean isConsumer(ImageConsumer ic);
  38. /**
  39. * This method removes the given ImageConsumer object
  40. * from the list of consumers currently registered to
  41. * receive image data. It is not considered an error
  42. * to remove a consumer that is not currently registered.
  43. * The ImageProducer should stop sending data to this
  44. * consumer as soon as is feasible.
  45. */
  46. public void removeConsumer(ImageConsumer ic);
  47. /**
  48. * This method both registers the given ImageConsumer object
  49. * as a consumer and starts an immediate reconstruction of
  50. * the image data which will then be delivered to this
  51. * consumer and any other consumer which may have already
  52. * been registered with the producer. This method differs
  53. * from the addConsumer method in that a reproduction of
  54. * the image data should be triggered as soon as possible.
  55. * @see #addConsumer
  56. */
  57. public void startProduction(ImageConsumer ic);
  58. /**
  59. * This method is used by an ImageConsumer to request that
  60. * the ImageProducer attempt to resend the image data one
  61. * more time in TOPDOWNLEFTRIGHT order so that higher
  62. * quality conversion algorithms which depend on receiving
  63. * pixels in order can be used to produce a better output
  64. * version of the image. The ImageProducer is free to
  65. * ignore this call if it cannot resend the data in that
  66. * order. If the data can be resent, then the ImageProducer
  67. * should respond by executing the following minimum set of
  68. * ImageConsumer method calls:
  69. * <pre>
  70. * ic.setHints(TOPDOWNLEFTRIGHT | < otherhints >);
  71. * ic.setPixels(...); // As many times as needed
  72. * ic.imageComplete();
  73. * </pre>
  74. * @see ImageConsumer#setHints
  75. */
  76. public void requestTopDownLeftRightResend(ImageConsumer ic);
  77. }