1. /*
  2. * @(#)RasterOp.java 1.12 03/01/23
  3. *
  4. * Copyright 2003 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 Raster objects. It is implemented by such
  14. * classes as AffineTransformOp, ConvolveOp, and LookupOp. The Source
  15. * and Destination objects must contain the appropriate number
  16. * of bands for the particular classes implementing this interface.
  17. * Otherwise, an exception is thrown. This interface cannot be used to
  18. * describe more sophisticated Ops such as ones that take multiple sources.
  19. * Each class implementing this interface will specify whether or not it
  20. * will allow an in-place filtering operation (i.e. source object equal
  21. * to the destination object). Note that the restriction to single-input
  22. * operations means that the values of destination pixels prior to the
  23. * operation are not used as input to the filter operation.
  24. * @see AffineTransformOp
  25. * @see BandCombineOp
  26. * @see ColorConvertOp
  27. * @see ConvolveOp
  28. * @see LookupOp
  29. * @see RescaleOp
  30. * @version 10 Feb 1997
  31. */
  32. public interface RasterOp {
  33. /**
  34. * Performs a single-input/single-output operation from a source Raster
  35. * to a destination Raster. If the destination Raster is null, a
  36. * new Raster will be created. The IllegalArgumentException may be thrown
  37. * if the source and/or destination Raster is incompatible with the types
  38. * of Rasters allowed by the class implementing this filter.
  39. * @param src the source <code>Raster</code>
  40. * @param dest the destination <code>WritableRaster</code>
  41. * @return a <code>WritableRaster</code> that represents the result of
  42. * the filtering operation.
  43. */
  44. public WritableRaster filter(Raster src, WritableRaster dest);
  45. /**
  46. * Returns the bounding box of the filtered destination Raster.
  47. * The IllegalArgumentException may be thrown if the source Raster
  48. * is incompatible with the types of Rasters allowed
  49. * by the class implementing this filter.
  50. * @param src the source <code>Raster</code>
  51. * @return a <code>Rectangle2D</code> that is the bounding box of
  52. * the <code>Raster</code> resulting from the filtering
  53. * operation.
  54. */
  55. public Rectangle2D getBounds2D(Raster src);
  56. /**
  57. * Creates a zeroed destination Raster with the correct size and number of
  58. * bands.
  59. * The IllegalArgumentException may be thrown if the source Raster
  60. * is incompatible with the types of Rasters allowed
  61. * by the class implementing this filter.
  62. * @param src the source <code>Raster</code>
  63. * @return a <code>WritableRaster</code> that is compatible with
  64. * <code>src</code>
  65. */
  66. public WritableRaster createCompatibleDestRaster(Raster src);
  67. /**
  68. * Returns the location of the destination point given a
  69. * point in the source Raster. If dstPt is non-null, it
  70. * will be used to hold the return value.
  71. * @param srcPt the source <code>Point2D</code>
  72. * @param dstPt the destination <code>Point2D</code>
  73. * @return the location of the destination point.
  74. */
  75. public Point2D getPoint2D(Point2D srcPt, Point2D dstPt);
  76. /**
  77. * Returns the rendering hints for this RasterOp. Returns
  78. * null if no hints have been set.
  79. * @return the <code>RenderingHints</code> object of this
  80. * <code>RasterOp</code>.
  81. */
  82. public RenderingHints getRenderingHints();
  83. }