1/*
2 *  Licensed to the Apache Software Foundation (ASF) under one or more
3 *  contributor license agreements.  See the NOTICE file distributed with
4 *  this work for additional information regarding copyright ownership.
5 *  The ASF licenses this file to You under the Apache License, Version 2.0
6 *  (the "License"); you may not use this file except in compliance with
7 *  the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 */
17/**
18 * @author Alexey A. Petrenko
19 * @version $Revision$
20 */
21
22package java.awt.image;
23
24import java.awt.RenderingHints;
25import java.awt.geom.Point2D;
26import java.awt.geom.Rectangle2D;
27
28/**
29 * The BufferedImageOp interface provides methods for performing transformations
30 * from source data to destination data for BufferedImage objects. An object
31 * implementing this interface can be passed into a BufferedImageFilter to
32 * operate on a BufferedImage.
33 *
34 * @since Android 1.0
35 */
36public interface BufferedImageOp {
37
38    /**
39     * Creates a destination image with the specified BufferedImage and
40     * ColorModel; this destination image is empty and has the correct size and
41     * number of bands.
42     *
43     * @param src
44     *            the source BufferedImage.
45     * @param destCM
46     *            the destination ColorModel.
47     * @return the BufferedImage.
48     */
49    public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM);
50
51    /**
52     * Performs a filter operation on the source BufferedImage and stores the
53     * resulting BufferedImage to the destination BufferedImage. If the
54     * destination BufferedImage is null, a BufferedImage with an appropriate
55     * ColorModel is created.
56     *
57     * @param src
58     *            the source BufferedImage.
59     * @param dest
60     *            the destination BufferedImage, where the result is stored.
61     * @return the filtered BufferedImage.
62     */
63    public BufferedImage filter(BufferedImage src, BufferedImage dest);
64
65    /**
66     * Gets the bounds of filtered image.
67     *
68     * @param src
69     *            the source BufferedImage to be filtered.
70     * @return the rectangle bounds of filtered image.
71     */
72    public Rectangle2D getBounds2D(BufferedImage src);
73
74    /**
75     * Gets the point of the destination image which corresponds to the
76     * specified point in the source image.
77     *
78     * @param srcPt
79     *            the point of the source image.
80     * @param dstPt
81     *            the point where the result will be stored.
82     * @return the destination point.
83     */
84    public Point2D getPoint2D(Point2D srcPt, Point2D dstPt);
85
86    /**
87     * Gets the RenderingHints of the BufferedImageOp.
88     *
89     * @return the RenderingHints of the BufferedImageOp.
90     */
91    public RenderingHints getRenderingHints();
92}
93