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