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