1. /*
  2. * @(#)RenderedImage.java 1.17 00/02/02
  3. *
  4. * Copyright 1997-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. /* ****************************************************************
  11. ******************************************************************
  12. ******************************************************************
  13. *** COPYRIGHT (c) Eastman Kodak Company, 1997
  14. *** As an unpublished work pursuant to Title 17 of the United
  15. *** States Code. All rights reserved.
  16. ******************************************************************
  17. ******************************************************************
  18. ******************************************************************/
  19. package java.awt.image;
  20. import java.awt.Rectangle;
  21. import java.util.Dictionary;
  22. import java.util.Vector;
  23. /**
  24. * RenderedImage is a common interface for objects which contain
  25. * or can produce image data in the form of Rasters. The image
  26. * data may be stored/produced as a single tile or a regular array
  27. * of tiles.
  28. */
  29. public interface RenderedImage {
  30. /**
  31. * Returns a vector of RenderedImages that are the immediate sources of
  32. * image data for this RenderedImage. This method returns null if
  33. * the RenderedImage object has no information about its immediate
  34. * sources. It returns an empty Vector if the RenderedImage object has
  35. * no immediate sources.
  36. */
  37. Vector getSources();
  38. /**
  39. * Gets a property from the property set of this image. The set of
  40. * properties and whether it is immutable is determined by the
  41. * implementing class. This method returns
  42. * java.awt.Image.UndefinedProperty if the specified property is
  43. * not defined for this RenderedImage.
  44. * @see java.awt.Image#UndefinedProperty
  45. */
  46. Object getProperty(String name);
  47. /**
  48. * Returns an array of names recognized by
  49. * {@link #getProperty(String) getProperty(String)}
  50. * or <code>null</code>, if no property names are recognized.
  51. * @return a <code>String</code> array containing all of the
  52. * property names that <code>getProperty(String)</code> recognizes;
  53. * or <code>null</code> if no property names are recognized.
  54. */
  55. String[] getPropertyNames();
  56. /**
  57. * Returns the ColorModel associated with this image. All Rasters returned
  58. * from this image will have this as their ColorModel. This can return
  59. * null.
  60. */
  61. ColorModel getColorModel();
  62. /**
  63. * Returns the SampleModel associated with this image. All Rasters returned
  64. * from this image will have this as their SampleModel.
  65. */
  66. SampleModel getSampleModel();
  67. /**
  68. * Returns the width of the RenderedImage.
  69. */
  70. int getWidth();
  71. /**
  72. * Returns the height of the RenderedImage.
  73. */
  74. int getHeight();
  75. /**
  76. * Returns the minimum X coordinate (inclusive) of the RenderedImage.
  77. */
  78. int getMinX();
  79. /**
  80. * Returns the minimum Y coordinate (inclusive) of the RenderedImage.
  81. */
  82. int getMinY();
  83. /**
  84. * Returns the number of tiles in the X direction.
  85. */
  86. int getNumXTiles();
  87. /**
  88. * Returns the number of tiles in the Y direction.
  89. */
  90. int getNumYTiles();
  91. /** Returns the minimum tile index in the X direction. */
  92. int getMinTileX();
  93. /** Returns the minimum tile index in the Y direction. */
  94. int getMinTileY();
  95. /** Returns the tile width in pixels. All tiles must have the same width.
  96. */
  97. int getTileWidth();
  98. /** Returns the tile height in pixels. All tiles must have the same height.
  99. */
  100. int getTileHeight();
  101. /**
  102. * Returns the X offset of the tile grid relative to the origin,
  103. * i.e., the X coordinate of the upper-left pixel of tile (0, 0).
  104. * (Note that tile (0, 0) may not actually exist.)
  105. */
  106. int getTileGridXOffset();
  107. /**
  108. * Returns the Y offset of the tile grid relative to the origin,
  109. * i.e., the Y coordinate of the upper-left pixel of tile (0, 0).
  110. * (Note that tile (0, 0) may not actually exist.)
  111. */
  112. int getTileGridYOffset();
  113. /**
  114. * Returns tile (tileX, tileY). Note that tileX and tileY are indices
  115. * into the tile array, not pixel locations. The Raster that is returned
  116. * is live and will be updated if the image is changed.
  117. * @param tileX the X index of the requested tile in the tile array.
  118. * @param tileY the Y index of the requested tile in the tile array.
  119. */
  120. Raster getTile(int tileX, int tileY);
  121. /**
  122. * Returns the image as one large tile (for tile based
  123. * images this will require fetching the whole image
  124. * and copying the image data over). The Raster returned is
  125. * a copy of the image data and will not be updated if the image
  126. * is changed.
  127. */
  128. Raster getData();
  129. /**
  130. * Computes and returns an arbitrary region of the RenderedImage.
  131. * The Raster returned is a copy of the image data and will not
  132. * be updated if the image is changed.
  133. * @param rect the region of the RenderedImage to be returned.
  134. */
  135. Raster getData(Rectangle rect);
  136. /**
  137. * Computes an arbitrary rectangular region of the RenderedImage
  138. * and copies it into a caller-supplied WritableRaster. The region
  139. * to be computed is determined from the bounds of the supplied
  140. * WritableRaster. The supplied WritableRaster must have a
  141. * SampleModel that is compatible with this image. If raster is null,
  142. * an appropriate WritableRaster is created.
  143. * @param raster a WritableRaster to hold the returned portion of the
  144. * image, or null.
  145. * @return a reference to the supplied or created WritableRaster.
  146. */
  147. WritableRaster copyData(WritableRaster raster);
  148. }