jdk/src/share/classes/java/awt/image/BufferedImageOp.java
author tbell
Wed, 07 Oct 2009 14:15:01 -0700
changeset 3965 63aae8ce7f47
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.awt.image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.geom.Rectangle2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.geom.Point2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.RenderingHints;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * This interface describes single-input/single-output
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * operations performed on <CODE>BufferedImage</CODE> objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * It is implemented by <CODE>AffineTransformOp</CODE>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <CODE>ConvolveOp</CODE>, <CODE>ColorConvertOp</CODE>, <CODE>RescaleOp</CODE>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * and <CODE>LookupOp</CODE>.  These objects can be passed into
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * a <CODE>BufferedImageFilter</CODE> to operate on a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <CODE>BufferedImage</CODE> in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * ImageProducer-ImageFilter-ImageConsumer paradigm.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * Classes that implement this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * interface must specify whether or not they allow in-place filtering--
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * filter operations where the source object is equal to the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * This interface cannot be used to describe more sophisticated operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * such as those that take multiple sources. Note that this restriction also
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * means that the values of the destination pixels prior to the operation are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * not used as input to the filter operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @see BufferedImage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * @see BufferedImageFilter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * @see AffineTransformOp
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @see BandCombineOp
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * @see ColorConvertOp
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * @see ConvolveOp
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * @see LookupOp
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * @see RescaleOp
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
public interface BufferedImageOp {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * Performs a single-input/single-output operation on a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * <CODE>BufferedImage</CODE>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * If the color models for the two images do not match, a color
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * conversion into the destination color model is performed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * If the destination image is null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * a <CODE>BufferedImage</CODE> with an appropriate <CODE>ColorModel</CODE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * is created.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * An <CODE>IllegalArgumentException</CODE> may be thrown if the source
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * and/or destination image is incompatible with the types of images       $
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * allowed by the class implementing this filter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * @param src The <CODE>BufferedImage</CODE> to be filtered
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @param dest The <CODE>BufferedImage</CODE> in which to store the results$
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @return The filtered <CODE>BufferedImage</CODE>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @throws IllegalArgumentException If the source and/or destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * image is not compatible with the types of images allowed by the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * implementing this filter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    public BufferedImage filter(BufferedImage src, BufferedImage dest);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * Returns the bounding box of the filtered destination image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * An <CODE>IllegalArgumentException</CODE> may be thrown if the source
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * image is incompatible with the types of images allowed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * by the class implementing this filter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @param src The <CODE>BufferedImage</CODE> to be filtered
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * @return The <CODE>Rectangle2D</CODE> representing the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * image's bounding box.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    public Rectangle2D getBounds2D (BufferedImage src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * Creates a zeroed destination image with the correct size and number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * bands.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * An <CODE>IllegalArgumentException</CODE> may be thrown if the source
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * image is incompatible with the types of images allowed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * by the class implementing this filter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * @param src The <CODE>BufferedImage</CODE> to be filtered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @param destCM <CODE>ColorModel</CODE> of the destination.  If null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * the <CODE>ColorModel</CODE> of the source is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * @return The zeroed destination image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    public BufferedImage createCompatibleDestImage (BufferedImage src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                                                    ColorModel destCM);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * Returns the location of the corresponding destination point given a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * point in the source image.  If <CODE>dstPt</CODE> is specified, it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * is used to hold the return value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @param srcPt the <code>Point2D</code> that represents the point in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * the source image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @param dstPt The <CODE>Point2D</CODE> in which to store the result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @return The <CODE>Point2D</CODE> in the destination image that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * corresponds to the specified point in the source image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    public Point2D getPoint2D (Point2D srcPt, Point2D dstPt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * Returns the rendering hints for this operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @return The <CODE>RenderingHints</CODE> object for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * <CODE>BufferedImageOp</CODE>.  Returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * null if no hints have been set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    public RenderingHints getRenderingHints();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
}