2362N/A * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This class uses an affine transform to perform a linear mapping from 0N/A * 2D coordinates in the source image or <CODE>Raster</CODE> to 2D coordinates 0N/A * in the destination image or <CODE>Raster</CODE>. 0N/A * The type of interpolation that is used is specified through a constructor, 0N/A * either by a <CODE>RenderingHints</CODE> object or by one of the integer 0N/A * interpolation types defined in this class. 0N/A * If a <CODE>RenderingHints</CODE> object is specified in the constructor, the 0N/A * interpolation hint and the rendering quality hint are used to set 0N/A * the interpolation type for this operation. The color rendering hint 0N/A * and the dithering hint can be used when color conversion is required. 0N/A * Note that the following constraints have to be met: 0N/A * <li>The source and destination must be different. 0N/A * <li>For <CODE>Raster</CODE> objects, the number of bands in the source must 0N/A * be equal to the number of bands in the destination. 0N/A * @see AffineTransform 0N/A * @see BufferedImageFilter 0N/A * @see java.awt.RenderingHints#KEY_INTERPOLATION 0N/A * @see java.awt.RenderingHints#KEY_RENDERING 0N/A * @see java.awt.RenderingHints#KEY_COLOR_RENDERING 0N/A * @see java.awt.RenderingHints#KEY_DITHERING 0N/A * Nearest-neighbor interpolation type. 0N/A * Bilinear interpolation type. 0N/A * Bicubic interpolation type. 0N/A * Constructs an <CODE>AffineTransformOp</CODE> given an affine transform. 0N/A * The interpolation type is determined from the 0N/A * <CODE>RenderingHints</CODE> object. If the interpolation hint is 0N/A * defined, it will be used. Otherwise, if the rendering quality hint is 0N/A * defined, the interpolation type is determined from its value. If no 0N/A * hints are specified (<CODE>hints</CODE> is null), 0N/A * the interpolation type is {@link #TYPE_NEAREST_NEIGHBOR 0N/A * TYPE_NEAREST_NEIGHBOR}. 0N/A * @param xform The <CODE>AffineTransform</CODE> to use for the 0N/A * @param hints The <CODE>RenderingHints</CODE> object used to specify 0N/A * the interpolation type for the operation. 0N/A * @throws ImagingOpException if the transform is non-invertible. 0N/A * @see java.awt.RenderingHints#KEY_INTERPOLATION 0N/A * @see java.awt.RenderingHints#KEY_RENDERING 0N/A * Constructs an <CODE>AffineTransformOp</CODE> given an affine transform 0N/A * and the interpolation type. 0N/A * @param xform The <CODE>AffineTransform</CODE> to use for the operation. 0N/A * @param interpolationType One of the integer 0N/A * interpolation type constants defined by this class: 0N/A * {@link #TYPE_NEAREST_NEIGHBOR TYPE_NEAREST_NEIGHBOR}, 0N/A * {@link #TYPE_BILINEAR TYPE_BILINEAR}, 0N/A * {@link #TYPE_BICUBIC TYPE_BICUBIC}. 0N/A * @throws ImagingOpException if the transform is non-invertible. 0N/A * Returns the interpolation type used by this op. 0N/A * @return the interpolation type. 0N/A * @see #TYPE_NEAREST_NEIGHBOR 0N/A * @see #TYPE_BILINEAR 0N/A * @see #TYPE_BICUBIC 0N/A * Transforms the source <CODE>BufferedImage</CODE> and stores the results 0N/A * in the destination <CODE>BufferedImage</CODE>. 0N/A * If the color models for the two images do not match, a color 0N/A * conversion into the destination color model is performed. 0N/A * If the destination image is null, 0N/A * a <CODE>BufferedImage</CODE> is created with the source 0N/A * <CODE>ColorModel</CODE>. 0N/A * The coordinates of the rectangle returned by 0N/A * <code>getBounds2D(BufferedImage)</code> 0N/A * are not necessarily the same as the coordinates of the 0N/A * <code>BufferedImage</code> returned by this method. If the 0N/A * upper-left corner coordinates of the rectangle are 0N/A * negative then this part of the rectangle is not drawn. If the 0N/A * upper-left corner coordinates of the rectangle are positive 0N/A * then the filtered image is drawn at that position in the 0N/A * destination <code>BufferedImage</code>. 0N/A * An <CODE>IllegalArgumentException</CODE> is thrown if the source is 0N/A * the same as the destination. 0N/A * @param src The <CODE>BufferedImage</CODE> to transform. 0N/A * @param dst The <CODE>BufferedImage</CODE> in which to store the results 0N/A * of the transformation. 0N/A * @return The filtered <CODE>BufferedImage</CODE>. 0N/A * @throws IllegalArgumentException if <code>src</code> and 0N/A * <code>dst</code> are the same 0N/A * @throws ImagingOpException if the image cannot be transformed 0N/A * because of a data-processing error that might be 0N/A * caused by an invalid image format, tile format, or 0N/A * image-processing operation, or any other unsupported 0N/A "same as the dst image");
0N/A // Check out the matrix. A non-integral scale will force ARGB 0N/A // since the edge conditions can't be guaranteed. 0N/A // Need to convert first 0N/A * Transforms the source <CODE>Raster</CODE> and stores the results in 0N/A * the destination <CODE>Raster</CODE>. This operation performs the 0N/A * transform band by band. 0N/A * If the destination <CODE>Raster</CODE> is null, a new 0N/A * <CODE>Raster</CODE> is created. 0N/A * An <CODE>IllegalArgumentException</CODE> may be thrown if the source is 0N/A * the same as the destination or if the number of bands in 0N/A * the source is not equal to the number of bands in the 0N/A * The coordinates of the rectangle returned by 0N/A * <code>getBounds2D(Raster)</code> 0N/A * are not necessarily the same as the coordinates of the 0N/A * <code>WritableRaster</code> returned by this method. If the 0N/A * upper-left corner coordinates of rectangle are negative then 0N/A * this part of the rectangle is not drawn. If the coordinates 0N/A * of the rectangle are positive then the filtered image is drawn at 0N/A * that position in the destination <code>Raster</code>. 0N/A * @param src The <CODE>Raster</CODE> to transform. 0N/A * @param dst The <CODE>Raster</CODE> in which to store the results of the 0N/A * @return The transformed <CODE>Raster</CODE>. 0N/A * @throws ImagingOpException if the raster cannot be transformed 0N/A * because of a data-processing error that might be 0N/A * caused by an invalid image format, tile format, or 0N/A * image-processing operation, or any other unsupported 0N/A "same as the dst image");
0N/A ") does not match number of "+
0N/A * Returns the bounding box of the transformed destination. The 0N/A * rectangle returned is the actual bounding box of the 0N/A * transformed points. The coordinates of the upper-left corner 0N/A * of the returned rectangle might not be (0, 0). 0N/A * @param src The <CODE>BufferedImage</CODE> to be transformed. 0N/A * @return The <CODE>Rectangle2D</CODE> representing the destination's 0N/A * Returns the bounding box of the transformed destination. The 0N/A * rectangle returned will be the actual bounding box of the 0N/A * transformed points. The coordinates of the upper-left corner 0N/A * of the returned rectangle might not be (0, 0). 0N/A * @param src The <CODE>Raster</CODE> to be transformed. 0N/A * @return The <CODE>Rectangle2D</CODE> representing the destination's 0N/A // Get the bounding box of the src and transform the corners 0N/A float[]
pts = {
0,
0, w,
0, w, h,
0, h};
0N/A // Get the min, max of the dst 0N/A for (
int i=
2; i <
8; i+=
2) {
0N/A * Creates a zeroed destination image with the correct size and number of 0N/A * bands. A <CODE>RasterFormatException</CODE> may be thrown if the 0N/A * transformed width or height is equal to 0. 0N/A * If <CODE>destCM</CODE> is null, 0N/A * an appropriate <CODE>ColorModel</CODE> is used; this 0N/A * <CODE>ColorModel</CODE> may have 0N/A * an alpha channel even if the source <CODE>ColorModel</CODE> is opaque. 0N/A * @param src The <CODE>BufferedImage</CODE> to be transformed. 0N/A * @param destCM <CODE>ColorModel</CODE> of the destination. If null, 0N/A * an appropriate <CODE>ColorModel</CODE> is used. 0N/A * @return The zeroed destination image. 0N/A // If r.x (or r.y) is < 0, then we want to only create an image 0N/A // that is in the positive range. 0N/A // If r.x (or r.y) is > 0, then we need to create an image that 0N/A // includes the translation. 0N/A ") is less than or equal to 0.");
0N/A ") is less than or equal to 0.");
0N/A * Creates a zeroed destination <CODE>Raster</CODE> with the correct size 0N/A * and number of bands. A <CODE>RasterFormatException</CODE> may be thrown 0N/A * if the transformed width or height is equal to 0. 0N/A * @param src The <CODE>Raster</CODE> to be transformed. 0N/A * @return The zeroed destination <CODE>Raster</CODE>. 0N/A * Returns the location of the corresponding destination point given a 0N/A * point in the source. If <CODE>dstPt</CODE> is specified, it 0N/A * is used to hold the return value. 0N/A * @param srcPt The <code>Point2D</code> that represents the source 0N/A * @param dstPt The <CODE>Point2D</CODE> in which to store the result. 0N/A * @return The <CODE>Point2D</CODE> in the destination that corresponds to 0N/A * the specified point in the source. 0N/A * Returns the affine transform used by this transform operation. 0N/A * @return The <CODE>AffineTransform</CODE> associated with this op. 0N/A * Returns the rendering hints used by this transform operation. 0N/A * @return The <CODE>RenderingHints</CODE> object associated with this op. 0N/A // Should never get here 0N/A // We need to be able to invert the transform if we want to 0N/A // transform the image. If the determinant of the matrix is 0, 0N/A // then we can't invert the transform.