blob: bd5853de4271a040fd0b2d6e4f0ba99b361aee65 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package java.awt.image;
27
28import java.awt.geom.Rectangle2D;
29import java.awt.geom.Point2D;
30import java.awt.RenderingHints;
31
32/**
33 * This interface describes single-input/single-output
34 * operations performed on Raster objects. It is implemented by such
35 * classes as AffineTransformOp, ConvolveOp, and LookupOp. The Source
36 * and Destination objects must contain the appropriate number
37 * of bands for the particular classes implementing this interface.
38 * Otherwise, an exception is thrown. This interface cannot be used to
39 * describe more sophisticated Ops such as ones that take multiple sources.
40 * Each class implementing this interface will specify whether or not it
41 * will allow an in-place filtering operation (i.e. source object equal
42 * to the destination object). Note that the restriction to single-input
43 * operations means that the values of destination pixels prior to the
44 * operation are not used as input to the filter operation.
45 * @see AffineTransformOp
46 * @see BandCombineOp
47 * @see ColorConvertOp
48 * @see ConvolveOp
49 * @see LookupOp
50 * @see RescaleOp
51 */
52public interface RasterOp {
53 /**
54 * Performs a single-input/single-output operation from a source Raster
55 * to a destination Raster. If the destination Raster is null, a
56 * new Raster will be created. The IllegalArgumentException may be thrown
57 * if the source and/or destination Raster is incompatible with the types
58 * of Rasters allowed by the class implementing this filter.
59 * @param src the source <code>Raster</code>
60 * @param dest the destination <code>WritableRaster</code>
61 * @return a <code>WritableRaster</code> that represents the result of
62 * the filtering operation.
63 */
64 public WritableRaster filter(Raster src, WritableRaster dest);
65
66 /**
67 * Returns the bounding box of the filtered destination Raster.
68 * The IllegalArgumentException may be thrown if the source Raster
69 * is incompatible with the types of Rasters allowed
70 * by the class implementing this filter.
71 * @param src the source <code>Raster</code>
72 * @return a <code>Rectangle2D</code> that is the bounding box of
73 * the <code>Raster</code> resulting from the filtering
74 * operation.
75 */
76 public Rectangle2D getBounds2D(Raster src);
77
78 /**
79 * Creates a zeroed destination Raster with the correct size and number of
80 * bands.
81 * The IllegalArgumentException may be thrown if the source Raster
82 * is incompatible with the types of Rasters allowed
83 * by the class implementing this filter.
84 * @param src the source <code>Raster</code>
85 * @return a <code>WritableRaster</code> that is compatible with
86 * <code>src</code>
87 */
88 public WritableRaster createCompatibleDestRaster(Raster src);
89
90 /**
91 * Returns the location of the destination point given a
92 * point in the source Raster. If dstPt is non-null, it
93 * will be used to hold the return value.
94 * @param srcPt the source <code>Point2D</code>
95 * @param dstPt the destination <code>Point2D</code>
96 * @return the location of the destination point.
97 */
98 public Point2D getPoint2D(Point2D srcPt, Point2D dstPt);
99
100 /**
101 * Returns the rendering hints for this RasterOp. Returns
102 * null if no hints have been set.
103 * @return the <code>RenderingHints</code> object of this
104 * <code>RasterOp</code>.
105 */
106 public RenderingHints getRenderingHints();
107}