1. /*
  2. * @(#)BufferedImageOp.java 1.21 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 BufferedImage objects.
  14. * It is implemented by such classes as AffineTransformOp, ConvolveOp,
  15. * BandCombineOp, and LookupOp. These objects can be passed into
  16. * a BufferedImageFilter to operate on a BufferedImage in the
  17. * ImageProducer-ImageFilter-ImageConsumer paradigm.
  18. * This interface cannot be used to describe more sophisticated Ops
  19. * such as ones that take multiple sources. Each class implementing this
  20. * interface will specify whether or not it will allow an in-place filtering
  21. * operation (i.e. source object equal to the destination object). Note
  22. * that the restriction to single-input operations means that the
  23. * values of destination pixels prior to the operation are not used
  24. * as input to the filter operation.
  25. * @see BufferedImage
  26. * @see BufferedImageFilter
  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 BufferedImageOp {
  36. /**
  37. * Performs a single-input/single-output operation on a BufferedImage.
  38. * If the color models for the two images do not match, a color
  39. * conversion into the destination color model will be performed.
  40. * If the destination image is null,
  41. * a BufferedImage with an appropriate ColorModel will be created.
  42. * The IllegalArgumentException may be thrown if the source and/or
  43. * destination image is incompatible with the types of images allowed
  44. * by the class implementing this filter.
  45. */
  46. public BufferedImage filter(BufferedImage src, BufferedImage dest);
  47. /**
  48. * Returns the bounding box of the filtered destination image.
  49. * The IllegalArgumentException may be thrown if the source
  50. * image is incompatible with the types of images allowed
  51. * by the class implementing this filter.
  52. */
  53. public Rectangle2D getBounds2D (BufferedImage src);
  54. /**
  55. * Creates a zeroed destination image with the correct size and number of
  56. * bands.
  57. * The IllegalArgumentException may be thrown if the source
  58. * image is incompatible with the types of images allowed
  59. * by the class implementing this filter.
  60. * @param src Source image for the filter operation.
  61. * @param destCM ColorModel of the destination. If null, the
  62. * ColorModel of the source will be used.
  63. */
  64. public BufferedImage createCompatibleDestImage (BufferedImage src,
  65. ColorModel destCM);
  66. /**
  67. * Returns the location of the destination point given a
  68. * point in the source image. If dstPt is non-null, it
  69. * will be used to hold the return value.
  70. */
  71. public Point2D getPoint2D (Point2D srcPt, Point2D dstPt);
  72. /**
  73. * Returns the rendering hints for this BufferedImageOp. Returns
  74. * null if no hints have been set.
  75. */
  76. public RenderingHints getRenderingHints();
  77. }