1. /*
  2. * @(#)RasterOp.java 1.8 01/11/29
  3. *
  4. * Copyright 2002 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. */
  40. public WritableRaster filter(Raster src, WritableRaster dest);
  41. /**
  42. * Returns the bounding box of the filtered destination Raster.
  43. * The IllegalArgumentException may be thrown if the source Raster
  44. * is incompatible with the types of Rasters allowed
  45. * by the class implementing this filter.
  46. */
  47. public Rectangle2D getBounds2D(Raster src);
  48. /**
  49. * Creates a zeroed destination Raster with the correct size and number of
  50. * bands.
  51. * The IllegalArgumentException may be thrown if the source Raster
  52. * is incompatible with the types of Rasters allowed
  53. * by the class implementing this filter.
  54. */
  55. public WritableRaster createCompatibleDestRaster(Raster src);
  56. /**
  57. * Returns the location of the destination point given a
  58. * point in the source Raster. If dstPt is non-null, it
  59. * will be used to hold the return value.
  60. */
  61. public Point2D getPoint2D(Point2D srcPt, Point2D dstPt);
  62. /**
  63. * Returns the rendering hints for this RasterOp. Returns
  64. * null if no hints have been set.
  65. */
  66. public RenderingHints getRenderingHints();
  67. }