1. /*
  2. * @(#)BufferedImageOp.java 1.26 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt.image;
  8. import java.awt.geom.Rectangle2D;
  9. import java.awt.geom.Point2D;
  10. import java.awt.RenderingHints;
  11. /**
  12. * This interface describes single-input/single-output
  13. * operations performed on <CODE>BufferedImage</CODE> objects.
  14. * It is implemented by <CODE>AffineTransformOp</CODE>,
  15. * <CODE>ConvolveOp</CODE>, <CODE>ColorConvertOp</CODE>, <CODE>RescaleOp</CODE>,
  16. * and <CODE>LookupOp</CODE>. These objects can be passed into
  17. * a <CODE>BufferedImageFilter</CODE> to operate on a
  18. * <CODE>BufferedImage</CODE> in the
  19. * ImageProducer-ImageFilter-ImageConsumer paradigm.
  20. * <p>
  21. * Classes that implement this
  22. * interface must specify whether or not they allow in-place filtering--
  23. * filter operations where the source object is equal to the destination
  24. * object.
  25. * <p>
  26. * This interface cannot be used to describe more sophisticated operations
  27. * such as those that take multiple sources. Note that this restriction also
  28. * means that the values of the destination pixels prior to the operation are
  29. * not used as input to the filter operation.
  30. * @see BufferedImage
  31. * @see BufferedImageFilter
  32. * @see AffineTransformOp
  33. * @see BandCombineOp
  34. * @see ColorConvertOp
  35. * @see ConvolveOp
  36. * @see LookupOp
  37. * @see RescaleOp
  38. * @version 10 Feb 1997
  39. */
  40. public interface BufferedImageOp {
  41. /**
  42. * Performs a single-input/single-output operation on a
  43. * <CODE>BufferedImage</CODE>.
  44. * If the color models for the two images do not match, a color
  45. * conversion into the destination color model is performed.
  46. * If the destination image is null,
  47. * a <CODE>BufferedImage</CODE> with an appropriate <CODE>ColorModel</CODE>
  48. * is created.
  49. * <p>
  50. * An <CODE>IllegalArgumentException</CODE> may be thrown if the source
  51. * and/or destination image is incompatible with the types of images $
  52. * allowed by the class implementing this filter.
  53. *
  54. * @param src The <CODE>BufferedImage</CODE> to be filtered
  55. * @param dest The <CODE>BufferedImage</CODE> in which to store the results$
  56. *
  57. * @return The filtered <CODE>BufferedImage</CODE>.
  58. *
  59. * @throws IllegalArgumentException If the source and/or destination
  60. * image is not compatible with the types of images allowed by the class
  61. * implementing this filter.
  62. */
  63. public BufferedImage filter(BufferedImage src, BufferedImage dest);
  64. /**
  65. * Returns the bounding box of the filtered destination image.
  66. * An <CODE>IllegalArgumentException</CODE> may be thrown if the source
  67. * image is incompatible with the types of images allowed
  68. * by the class implementing this filter.
  69. *
  70. * @param src The <CODE>BufferedImage</CODE> to be filtered
  71. *
  72. * @return The <CODE>Rectangle2D</CODE> representing the destination
  73. * image's bounding box.
  74. */
  75. public Rectangle2D getBounds2D (BufferedImage src);
  76. /**
  77. * Creates a zeroed destination image with the correct size and number of
  78. * bands.
  79. * An <CODE>IllegalArgumentException</CODE> may be thrown if the source
  80. * image is incompatible with the types of images allowed
  81. * by the class implementing this filter.
  82. *
  83. * @param src The <CODE>BufferedImage</CODE> to be filtered
  84. * @param destCM <CODE>ColorModel</CODE> of the destination. If null,
  85. * the <CODE>ColorModel</CODE> of the source is used.
  86. *
  87. * @return The zeroed destination image.
  88. */
  89. public BufferedImage createCompatibleDestImage (BufferedImage src,
  90. ColorModel destCM);
  91. /**
  92. * Returns the location of the corresponding destination point given a
  93. * point in the source image. If <CODE>dstPt</CODE> is specified, it
  94. * is used to hold the return value.
  95. * @param srcPt the <code>Point2D</code> that represents the point in
  96. * the source image
  97. * @param dstPt The <CODE>Point2D</CODE> in which to store the result
  98. *
  99. * @return The <CODE>Point2D</CODE> in the destination image that
  100. * corresponds to the specified point in the source image.
  101. */
  102. public Point2D getPoint2D (Point2D srcPt, Point2D dstPt);
  103. /**
  104. * Returns the rendering hints for this operation.
  105. *
  106. * @return The <CODE>RenderingHints</CODE> object for this
  107. * <CODE>BufferedImageOp</CODE. Returns
  108. * null if no hints have been set.
  109. */
  110. public RenderingHints getRenderingHints();
  111. }