src/java.desktop/share/classes/java/awt/image/BufferedImageOp.java
author tvaleev
Thu, 04 Oct 2018 12:40:55 -0700
changeset 52248 2e330da7cbf4
parent 47216 71c04702a3d5
permissions -rw-r--r--
8211300: Convert C-style array declarations in JDK client code Reviewed-by: prr, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
2
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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
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
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    34
 * operations performed on {@code BufferedImage} objects.
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    35
 * It is implemented by {@code AffineTransformOp},
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    36
 * {@code ConvolveOp}, {@code ColorConvertOp}, {@code RescaleOp},
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    37
 * and {@code LookupOp}.  These objects can be passed into
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    38
 * a {@code BufferedImageFilter} to operate on a
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    39
 * {@code BufferedImage} in the
2
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
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    64
     * {@code BufferedImage}.
2
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,
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    68
     * a {@code BufferedImage} with an appropriate {@code ColorModel}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * is created.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * <p>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    71
     * An {@code IllegalArgumentException} may be thrown if the source
2
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
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    75
     * @param src The {@code BufferedImage} to be filtered
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    76
     * @param dest The {@code BufferedImage} in which to store the results$
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    78
     * @return The filtered {@code BufferedImage}.
2
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.
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    88
     * An {@code IllegalArgumentException} may be thrown if the source
2
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
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    92
     * @param src The {@code BufferedImage} to be filtered
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    94
     * @return The {@code Rectangle2D} representing the destination
2
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.
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   102
     * An {@code IllegalArgumentException} may be thrown if the source
2
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
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   106
     * @param src The {@code BufferedImage} to be filtered
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   107
     * @param destCM {@code ColorModel} of the destination.  If null,
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   108
     * the {@code ColorModel} of the source is used.
2
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
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   117
     * point in the source image.  If {@code dstPt} is specified, it
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * is used to hold the return value.
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   119
     * @param srcPt the {@code Point2D} that represents the point in
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * the source image
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   121
     * @param dstPt The {@code Point2D} in which to store the result
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   123
     * @return The {@code Point2D} in the destination image that
2
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
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   131
     * @return The {@code RenderingHints} object for this
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   132
     * {@code BufferedImageOp}.  Returns
2
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
}