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