1. /*
  2. * @(#)ImageObserver.java 1.24 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. import java.awt.Image;
  12. /**
  13. * An asynchronous update interface for receiving notifications about
  14. * Image information as the Image is constructed.
  15. *
  16. * @version 1.24 02/02/00
  17. * @author Jim Graham
  18. */
  19. public interface ImageObserver {
  20. /**
  21. * This method is called when information about an image which was
  22. * previously requested using an asynchronous interface becomes
  23. * available. Asynchronous interfaces are method calls such as
  24. * getWidth(ImageObserver) and drawImage(img, x, y, ImageObserver)
  25. * which take an ImageObserver object as an argument. Those methods
  26. * register the caller as interested either in information about
  27. * the overall image itself (in the case of getWidth(ImageObserver))
  28. * or about an output version of an image (in the case of the
  29. * drawImage(img, x, y, [w, h,] ImageObserver) call).
  30. *
  31. * <p>This method
  32. * should return true if further updates are needed or false if the
  33. * required information has been acquired. The image which was being
  34. * tracked is passed in using the img argument. Various constants
  35. * are combined to form the infoflags argument which indicates what
  36. * information about the image is now available. The interpretation
  37. * of the x, y, width, and height arguments depends on the contents
  38. * of the infoflags argument.
  39. * <p>
  40. * The <code>infoflags</code> argument should be the bitwise inclusive
  41. * <b>OR</b> of the following flags: <code>WIDTH</code>,
  42. * <code>HEIGHT</code>, <code>PROPERTIES</code>, <code>SOMEBITS</code>,
  43. * <code>FRAMEBITS</code>, <code>ALLBITS</code>, <code>ERROR</code>,
  44. * <code>ABORT</code>.
  45. *
  46. * @param img the image being observed.
  47. * @param infoflags the bitwise inclusive OR of the following
  48. * flags: <code>WIDTH</code>, <code>HEIGHT</code>,
  49. * <code>PROPERTIES</code>, <code>SOMEBITS</code>,
  50. * <code>FRAMEBITS</code>, <code>ALLBITS</code>,
  51. * <code>ERROR</code>, <code>ABORT</code>.
  52. * @param x the <i>x</i> coordinate.
  53. * @param y the <i>y</i> coordinate.
  54. * @param width the width.
  55. * @param height the height.
  56. * @return <code>false</code> if the infoflags indicate that the
  57. * image is completely loaded; <code>true</code> otherwise.
  58. *
  59. * @see #WIDTH
  60. * @see #HEIGHT
  61. * @see #PROPERTIES
  62. * @see #SOMEBITS
  63. * @see #FRAMEBITS
  64. * @see #ALLBITS
  65. * @see #ERROR
  66. * @see #ABORT
  67. * @see Image#getWidth
  68. * @see Image#getHeight
  69. * @see java.awt.Graphics#drawImage
  70. */
  71. public boolean imageUpdate(Image img, int infoflags,
  72. int x, int y, int width, int height);
  73. /**
  74. * This flag in the infoflags argument to imageUpdate indicates that
  75. * the width of the base image is now available and can be taken
  76. * from the width argument to the imageUpdate callback method.
  77. * @see Image#getWidth
  78. * @see #imageUpdate
  79. */
  80. public static final int WIDTH = 1;
  81. /**
  82. * This flag in the infoflags argument to imageUpdate indicates that
  83. * the height of the base image is now available and can be taken
  84. * from the height argument to the imageUpdate callback method.
  85. * @see Image#getHeight
  86. * @see #imageUpdate
  87. */
  88. public static final int HEIGHT = 2;
  89. /**
  90. * This flag in the infoflags argument to imageUpdate indicates that
  91. * the properties of the image are now available.
  92. * @see Image#getProperty
  93. * @see #imageUpdate
  94. */
  95. public static final int PROPERTIES = 4;
  96. /**
  97. * This flag in the infoflags argument to imageUpdate indicates that
  98. * more pixels needed for drawing a scaled variation of the image
  99. * are available. The bounding box of the new pixels can be taken
  100. * from the x, y, width, and height arguments to the imageUpdate
  101. * callback method.
  102. * @see java.awt.Graphics#drawImage
  103. * @see #imageUpdate
  104. */
  105. public static final int SOMEBITS = 8;
  106. /**
  107. * This flag in the infoflags argument to imageUpdate indicates that
  108. * another complete frame of a multi-frame image which was previously
  109. * drawn is now available to be drawn again. The x, y, width, and height
  110. * arguments to the imageUpdate callback method should be ignored.
  111. * @see java.awt.Graphics#drawImage
  112. * @see #imageUpdate
  113. */
  114. public static final int FRAMEBITS = 16;
  115. /**
  116. * This flag in the infoflags argument to imageUpdate indicates that
  117. * a static image which was previously drawn is now complete and can
  118. * be drawn again in its final form. The x, y, width, and height
  119. * arguments to the imageUpdate callback method should be ignored.
  120. * @see java.awt.Graphics#drawImage
  121. * @see #imageUpdate
  122. */
  123. public static final int ALLBITS = 32;
  124. /**
  125. * This flag in the infoflags argument to imageUpdate indicates that
  126. * an image which was being tracked asynchronously has encountered
  127. * an error. No further information will become available and
  128. * drawing the image will fail.
  129. * As a convenience, the ABORT flag will be indicated at the same
  130. * time to indicate that the image production was aborted.
  131. * @see #imageUpdate
  132. */
  133. public static final int ERROR = 64;
  134. /**
  135. * This flag in the infoflags argument to imageUpdate indicates that
  136. * an image which was being tracked asynchronously was aborted before
  137. * production was complete. No more information will become available
  138. * without further action to trigger another image production sequence.
  139. * If the ERROR flag was not also set in this image update, then
  140. * accessing any of the data in the image will restart the production
  141. * again, probably from the beginning.
  142. * @see #imageUpdate
  143. */
  144. public static final int ABORT = 128;
  145. }