0N/A/*
2362N/A * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
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 *
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 *
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.
0N/A *
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
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.awt.image;
0N/A
0N/Aimport java.awt.color.ColorSpace;
0N/Aimport java.awt.geom.Rectangle2D;
0N/Aimport java.awt.Rectangle;
0N/Aimport java.awt.geom.Point2D;
0N/Aimport java.awt.RenderingHints;
0N/Aimport sun.awt.image.ImagingLib;
0N/A
0N/A/**
0N/A * This class performs a pixel-by-pixel rescaling of the data in the
0N/A * source image by multiplying the sample values for each pixel by a scale
0N/A * factor and then adding an offset. The scaled sample values are clipped
0N/A * to the minimum/maximum representable in the destination image.
0N/A * <p>
0N/A * The pseudo code for the rescaling operation is as follows:
0N/A * <pre>
0N/A *for each pixel from Source object {
0N/A * for each band/component of the pixel {
0N/A * dstElement = (srcElement*scaleFactor) + offset
0N/A * }
0N/A *}
0N/A * </pre>
0N/A * <p>
0N/A * For Rasters, rescaling operates on bands. The number of
0N/A * sets of scaling constants may be one, in which case the same constants
0N/A * are applied to all bands, or it must equal the number of Source
0N/A * Raster bands.
0N/A * <p>
0N/A * For BufferedImages, rescaling operates on color and alpha components.
0N/A * The number of sets of scaling constants may be one, in which case the
0N/A * same constants are applied to all color (but not alpha) components.
0N/A * Otherwise, the number of sets of scaling constants may
0N/A * equal the number of Source color components, in which case no
0N/A * rescaling of the alpha component (if present) is performed.
0N/A * If neither of these cases apply, the number of sets of scaling constants
0N/A * must equal the number of Source color components plus alpha components,
0N/A * in which case all color and alpha components are rescaled.
0N/A * <p>
0N/A * BufferedImage sources with premultiplied alpha data are treated in the same
0N/A * manner as non-premultiplied images for purposes of rescaling. That is,
0N/A * the rescaling is done per band on the raw data of the BufferedImage source
0N/A * without regard to whether the data is premultiplied. If a color conversion
0N/A * is required to the destination ColorModel, the premultiplied state of
0N/A * both source and destination will be taken into account for this step.
0N/A * <p>
0N/A * Images with an IndexColorModel cannot be rescaled.
0N/A * <p>
0N/A * If a RenderingHints object is specified in the constructor, the
0N/A * color rendering hint and the dithering hint may be used when color
0N/A * conversion is required.
0N/A * <p>
0N/A * Note that in-place operation is allowed (i.e. the source and destination can
0N/A * be the same object).
0N/A * @see java.awt.RenderingHints#KEY_COLOR_RENDERING
0N/A * @see java.awt.RenderingHints#KEY_DITHERING
0N/A */
0N/Apublic class RescaleOp implements BufferedImageOp, RasterOp {
0N/A float[] scaleFactors;
0N/A float[] offsets;
0N/A int length = 0;
0N/A RenderingHints hints;
0N/A
0N/A private int srcNbits;
0N/A private int dstNbits;
0N/A
0N/A
0N/A /**
0N/A * Constructs a new RescaleOp with the desired scale factors
0N/A * and offsets. The length of the scaleFactor and offset arrays
0N/A * must meet the restrictions stated in the class comments above.
0N/A * The RenderingHints argument may be null.
0N/A * @param scaleFactors the specified scale factors
0N/A * @param offsets the specified offsets
0N/A * @param hints the specified <code>RenderingHints</code>, or
0N/A * <code>null</code>
0N/A */
0N/A public RescaleOp (float[] scaleFactors, float[] offsets,
0N/A RenderingHints hints) {
0N/A length = scaleFactors.length;
0N/A if (length > offsets.length) length = offsets.length;
0N/A
0N/A this.scaleFactors = new float[length];
0N/A this.offsets = new float[length];
0N/A for (int i=0; i < length; i++) {
0N/A this.scaleFactors[i] = scaleFactors[i];
0N/A this.offsets[i] = offsets[i];
0N/A }
0N/A this.hints = hints;
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new RescaleOp with the desired scale factor
0N/A * and offset. The scaleFactor and offset will be applied to
0N/A * all bands in a source Raster and to all color (but not alpha)
0N/A * components in a BufferedImage.
0N/A * The RenderingHints argument may be null.
0N/A * @param scaleFactor the specified scale factor
0N/A * @param offset the specified offset
0N/A * @param hints the specified <code>RenderingHints</code>, or
0N/A * <code>null</code>
0N/A */
0N/A public RescaleOp (float scaleFactor, float offset, RenderingHints hints) {
0N/A length = 1;
0N/A this.scaleFactors = new float[1];
0N/A this.offsets = new float[1];
0N/A this.scaleFactors[0] = scaleFactor;
0N/A this.offsets[0] = offset;
0N/A this.hints = hints;
0N/A }
0N/A
0N/A /**
0N/A * Returns the scale factors in the given array. The array is also
0N/A * returned for convenience. If scaleFactors is null, a new array
0N/A * will be allocated.
0N/A * @param scaleFactors the array to contain the scale factors of
0N/A * this <code>RescaleOp</code>
0N/A * @return the scale factors of this <code>RescaleOp</code>.
0N/A */
0N/A final public float[] getScaleFactors (float scaleFactors[]) {
0N/A if (scaleFactors == null) {
0N/A return (float[]) this.scaleFactors.clone();
0N/A }
0N/A System.arraycopy (this.scaleFactors, 0, scaleFactors, 0,
0N/A Math.min(this.scaleFactors.length,
0N/A scaleFactors.length));
0N/A return scaleFactors;
0N/A }
0N/A
0N/A /**
0N/A * Returns the offsets in the given array. The array is also returned
0N/A * for convenience. If offsets is null, a new array
0N/A * will be allocated.
0N/A * @param offsets the array to contain the offsets of
0N/A * this <code>RescaleOp</code>
0N/A * @return the offsets of this <code>RescaleOp</code>.
0N/A */
0N/A final public float[] getOffsets(float offsets[]) {
0N/A if (offsets == null) {
0N/A return (float[]) this.offsets.clone();
0N/A }
0N/A
0N/A System.arraycopy (this.offsets, 0, offsets, 0,
0N/A Math.min(this.offsets.length, offsets.length));
0N/A return offsets;
0N/A }
0N/A
0N/A /**
0N/A * Returns the number of scaling factors and offsets used in this
0N/A * RescaleOp.
0N/A * @return the number of scaling factors and offsets of this
0N/A * <code>RescaleOp</code>.
0N/A */
0N/A final public int getNumFactors() {
0N/A return length;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Creates a ByteLookupTable to implement the rescale.
0N/A * The table may have either a SHORT or BYTE input.
0N/A * @param nElems Number of elements the table is to have.
0N/A * This will generally be 256 for byte and
0N/A * 65536 for short.
0N/A */
0N/A private ByteLookupTable createByteLut(float scale[],
0N/A float off[],
0N/A int nBands,
0N/A int nElems) {
0N/A
0N/A byte[][] lutData = new byte[scale.length][nElems];
0N/A
0N/A for (int band=0; band<scale.length; band++) {
0N/A float bandScale = scale[band];
0N/A float bandOff = off[band];
0N/A byte[] bandLutData = lutData[band];
0N/A for (int i=0; i<nElems; i++) {
0N/A int val = (int)(i*bandScale + bandOff);
0N/A if ((val & 0xffffff00) != 0) {
0N/A if (val < 0) {
0N/A val = 0;
0N/A } else {
0N/A val = 255;
0N/A }
0N/A }
0N/A bandLutData[i] = (byte)val;
0N/A }
0N/A
0N/A }
0N/A
0N/A return new ByteLookupTable(0, lutData);
0N/A }
0N/A
0N/A /**
0N/A * Creates a ShortLookupTable to implement the rescale.
0N/A * The table may have either a SHORT or BYTE input.
0N/A * @param nElems Number of elements the table is to have.
0N/A * This will generally be 256 for byte and
0N/A * 65536 for short.
0N/A */
0N/A private ShortLookupTable createShortLut(float scale[],
0N/A float off[],
0N/A int nBands,
0N/A int nElems) {
0N/A
0N/A short[][] lutData = new short[scale.length][nElems];
0N/A
0N/A for (int band=0; band<scale.length; band++) {
0N/A float bandScale = scale[band];
0N/A float bandOff = off[band];
0N/A short[] bandLutData = lutData[band];
0N/A for (int i=0; i<nElems; i++) {
0N/A int val = (int)(i*bandScale + bandOff);
0N/A if ((val & 0xffff0000) != 0) {
0N/A if (val < 0) {
0N/A val = 0;
0N/A } else {
0N/A val = 65535;
0N/A }
0N/A }
0N/A bandLutData[i] = (short)val;
0N/A }
0N/A }
0N/A
0N/A return new ShortLookupTable(0, lutData);
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Determines if the rescale can be performed as a lookup.
0N/A * The dst must be a byte or short type.
0N/A * The src must be less than 16 bits.
0N/A * All source band sizes must be the same and all dst band sizes
0N/A * must be the same.
0N/A */
0N/A private boolean canUseLookup(Raster src, Raster dst) {
0N/A
0N/A //
0N/A // Check that the src datatype is either a BYTE or SHORT
0N/A //
0N/A int datatype = src.getDataBuffer().getDataType();
0N/A if(datatype != DataBuffer.TYPE_BYTE &&
0N/A datatype != DataBuffer.TYPE_USHORT) {
0N/A return false;
0N/A }
0N/A
0N/A //
0N/A // Check dst sample sizes. All must be 8 or 16 bits.
0N/A //
0N/A SampleModel dstSM = dst.getSampleModel();
0N/A dstNbits = dstSM.getSampleSize(0);
0N/A
0N/A if (!(dstNbits == 8 || dstNbits == 16)) {
0N/A return false;
0N/A }
0N/A for (int i=1; i<src.getNumBands(); i++) {
0N/A int bandSize = dstSM.getSampleSize(i);
0N/A if (bandSize != dstNbits) {
0N/A return false;
0N/A }
0N/A }
0N/A
0N/A //
0N/A // Check src sample sizes. All must be the same size
0N/A //
0N/A SampleModel srcSM = src.getSampleModel();
0N/A srcNbits = srcSM.getSampleSize(0);
0N/A if (srcNbits > 16) {
0N/A return false;
0N/A }
0N/A for (int i=1; i<src.getNumBands(); i++) {
0N/A int bandSize = srcSM.getSampleSize(i);
0N/A if (bandSize != srcNbits) {
0N/A return false;
0N/A }
0N/A }
0N/A
0N/A return true;
0N/A }
0N/A
0N/A /**
0N/A * Rescales the source BufferedImage.
0N/A * If the color model in the source image is not the same as that
0N/A * in the destination image, the pixels will be converted
0N/A * in the destination. If the destination image is null,
0N/A * a BufferedImage will be created with the source ColorModel.
0N/A * An IllegalArgumentException may be thrown if the number of
0N/A * scaling factors/offsets in this object does not meet the
0N/A * restrictions stated in the class comments above, or if the
0N/A * source image has an IndexColorModel.
0N/A * @param src the <code>BufferedImage</code> to be filtered
0N/A * @param dst the destination for the filtering operation
0N/A * or <code>null</code>
0N/A * @return the filtered <code>BufferedImage</code>.
0N/A * @throws IllegalArgumentException if the <code>ColorModel</code>
0N/A * of <code>src</code> is an <code>IndexColorModel</code>,
0N/A * or if the number of scaling factors and offsets in this
0N/A * <code>RescaleOp</code> do not meet the requirements
0N/A * stated in the class comments.
0N/A */
0N/A public final BufferedImage filter (BufferedImage src, BufferedImage dst) {
0N/A ColorModel srcCM = src.getColorModel();
0N/A ColorModel dstCM;
0N/A int numBands = srcCM.getNumColorComponents();
0N/A
0N/A
0N/A if (srcCM instanceof IndexColorModel) {
0N/A throw new
0N/A IllegalArgumentException("Rescaling cannot be "+
0N/A "performed on an indexed image");
0N/A }
0N/A if (length != 1 && length != numBands &&
0N/A length != srcCM.getNumComponents())
0N/A {
0N/A throw new IllegalArgumentException("Number of scaling constants "+
0N/A "does not equal the number of"+
0N/A " of color or color/alpha "+
0N/A " components");
0N/A }
0N/A
0N/A boolean needToConvert = false;
0N/A
0N/A // Include alpha
0N/A if (length > numBands && srcCM.hasAlpha()) {
0N/A length = numBands+1;
0N/A }
0N/A
0N/A int width = src.getWidth();
0N/A int height = src.getHeight();
0N/A
0N/A if (dst == null) {
0N/A dst = createCompatibleDestImage(src, null);
0N/A dstCM = srcCM;
0N/A }
0N/A else {
0N/A if (width != dst.getWidth()) {
0N/A throw new
0N/A IllegalArgumentException("Src width ("+width+
0N/A ") not equal to dst width ("+
0N/A dst.getWidth()+")");
0N/A }
0N/A if (height != dst.getHeight()) {
0N/A throw new
0N/A IllegalArgumentException("Src height ("+height+
0N/A ") not equal to dst height ("+
0N/A dst.getHeight()+")");
0N/A }
0N/A
0N/A dstCM = dst.getColorModel();
0N/A if(srcCM.getColorSpace().getType() !=
0N/A dstCM.getColorSpace().getType()) {
0N/A needToConvert = true;
0N/A dst = createCompatibleDestImage(src, null);
0N/A }
0N/A
0N/A }
0N/A
0N/A BufferedImage origDst = dst;
0N/A
0N/A //
0N/A // Try to use a native BI rescale operation first
0N/A //
0N/A if (ImagingLib.filter(this, src, dst) == null) {
0N/A //
0N/A // Native BI rescale failed - convert to rasters
0N/A //
0N/A WritableRaster srcRaster = src.getRaster();
0N/A WritableRaster dstRaster = dst.getRaster();
0N/A
0N/A if (srcCM.hasAlpha()) {
0N/A if (numBands-1 == length || length == 1) {
0N/A int minx = srcRaster.getMinX();
0N/A int miny = srcRaster.getMinY();
0N/A int[] bands = new int[numBands-1];
0N/A for (int i=0; i < numBands-1; i++) {
0N/A bands[i] = i;
0N/A }
0N/A srcRaster =
0N/A srcRaster.createWritableChild(minx, miny,
0N/A srcRaster.getWidth(),
0N/A srcRaster.getHeight(),
0N/A minx, miny,
0N/A bands);
0N/A }
0N/A }
0N/A if (dstCM.hasAlpha()) {
0N/A int dstNumBands = dstRaster.getNumBands();
0N/A if (dstNumBands-1 == length || length == 1) {
0N/A int minx = dstRaster.getMinX();
0N/A int miny = dstRaster.getMinY();
0N/A int[] bands = new int[numBands-1];
0N/A for (int i=0; i < numBands-1; i++) {
0N/A bands[i] = i;
0N/A }
0N/A dstRaster =
0N/A dstRaster.createWritableChild(minx, miny,
0N/A dstRaster.getWidth(),
0N/A dstRaster.getHeight(),
0N/A minx, miny,
0N/A bands);
0N/A }
0N/A }
0N/A
0N/A //
0N/A // Call the raster filter method
0N/A //
0N/A filter(srcRaster, dstRaster);
0N/A
0N/A }
0N/A
0N/A if (needToConvert) {
0N/A // ColorModels are not the same
0N/A ColorConvertOp ccop = new ColorConvertOp(hints);
0N/A ccop.filter(dst, origDst);
0N/A }
0N/A
0N/A return origDst;
0N/A }
0N/A
0N/A /**
0N/A * Rescales the pixel data in the source Raster.
0N/A * If the destination Raster is null, a new Raster will be created.
0N/A * The source and destination must have the same number of bands.
0N/A * Otherwise, an IllegalArgumentException is thrown.
0N/A * Note that the number of scaling factors/offsets in this object must
0N/A * meet the restrictions stated in the class comments above.
0N/A * Otherwise, an IllegalArgumentException is thrown.
0N/A * @param src the <code>Raster</code> to be filtered
0N/A * @param dst the destination for the filtering operation
0N/A * or <code>null</code>
0N/A * @return the filtered <code>WritableRaster</code>.
0N/A * @throws IllegalArgumentException if <code>src</code> and
0N/A * <code>dst</code> do not have the same number of bands,
0N/A * or if the number of scaling factors and offsets in this
0N/A * <code>RescaleOp</code> do not meet the requirements
0N/A * stated in the class comments.
0N/A */
0N/A public final WritableRaster filter (Raster src, WritableRaster dst) {
0N/A int numBands = src.getNumBands();
0N/A int width = src.getWidth();
0N/A int height = src.getHeight();
0N/A int[] srcPix = null;
0N/A int step = 0;
0N/A int tidx = 0;
0N/A
0N/A // Create a new destination Raster, if needed
0N/A if (dst == null) {
0N/A dst = createCompatibleDestRaster(src);
0N/A }
0N/A else if (height != dst.getHeight() || width != dst.getWidth()) {
0N/A throw new
0N/A IllegalArgumentException("Width or height of Rasters do not "+
0N/A "match");
0N/A }
0N/A else if (numBands != dst.getNumBands()) {
0N/A // Make sure that the number of bands are equal
0N/A throw new IllegalArgumentException("Number of bands in src "
0N/A + numBands
0N/A + " does not equal number of bands in dest "
0N/A + dst.getNumBands());
0N/A }
0N/A // Make sure that the arrays match
0N/A // Make sure that the low/high/constant arrays match
0N/A if (length != 1 && length != src.getNumBands()) {
0N/A throw new IllegalArgumentException("Number of scaling constants "+
0N/A "does not equal the number of"+
0N/A " of bands in the src raster");
0N/A }
0N/A
0N/A
0N/A //
0N/A // Try for a native raster rescale first
0N/A //
0N/A if (ImagingLib.filter(this, src, dst) != null) {
0N/A return dst;
0N/A }
0N/A
0N/A //
0N/A // Native raster rescale failed.
0N/A // Try to see if a lookup operation can be used
0N/A //
0N/A if (canUseLookup(src, dst)) {
0N/A int srcNgray = (1 << srcNbits);
0N/A int dstNgray = (1 << dstNbits);
0N/A
0N/A if (dstNgray == 256) {
0N/A ByteLookupTable lut = createByteLut(scaleFactors, offsets,
0N/A numBands, srcNgray);
0N/A LookupOp op = new LookupOp(lut, hints);
0N/A op.filter(src, dst);
0N/A } else {
0N/A ShortLookupTable lut = createShortLut(scaleFactors, offsets,
0N/A numBands, srcNgray);
0N/A LookupOp op = new LookupOp(lut, hints);
0N/A op.filter(src, dst);
0N/A }
0N/A } else {
0N/A //
0N/A // Fall back to the slow code
0N/A //
0N/A if (length > 1) {
0N/A step = 1;
0N/A }
0N/A
0N/A int sminX = src.getMinX();
0N/A int sY = src.getMinY();
0N/A int dminX = dst.getMinX();
0N/A int dY = dst.getMinY();
0N/A int sX;
0N/A int dX;
0N/A
0N/A //
0N/A // Determine bits per band to determine maxval for clamps.
0N/A // The min is assumed to be zero.
0N/A // REMIND: This must change if we ever support signed data types.
0N/A //
0N/A int nbits;
0N/A int dstMax[] = new int[numBands];
0N/A int dstMask[] = new int[numBands];
0N/A SampleModel dstSM = dst.getSampleModel();
0N/A for (int z=0; z<numBands; z++) {
0N/A nbits = dstSM.getSampleSize(z);
0N/A dstMax[z] = (1 << nbits) - 1;
0N/A dstMask[z] = ~(dstMax[z]);
0N/A }
0N/A
0N/A int val;
0N/A for (int y=0; y < height; y++, sY++, dY++) {
0N/A dX = dminX;
0N/A sX = sminX;
0N/A for (int x = 0; x < width; x++, sX++, dX++) {
0N/A // Get data for all bands at this x,y position
0N/A srcPix = src.getPixel(sX, sY, srcPix);
0N/A tidx = 0;
0N/A for (int z=0; z<numBands; z++, tidx += step) {
0N/A val = (int)(srcPix[z]*scaleFactors[tidx]
0N/A + offsets[tidx]);
0N/A // Clamp
0N/A if ((val & dstMask[z]) != 0) {
0N/A if (val < 0) {
0N/A val = 0;
0N/A } else {
0N/A val = dstMax[z];
0N/A }
0N/A }
0N/A srcPix[z] = val;
0N/A
0N/A }
0N/A
0N/A // Put it back for all bands
0N/A dst.setPixel(dX, dY, srcPix);
0N/A }
0N/A }
0N/A }
0N/A return dst;
0N/A }
0N/A
0N/A /**
0N/A * Returns the bounding box of the rescaled destination image. Since
0N/A * this is not a geometric operation, the bounding box does not
0N/A * change.
0N/A */
0N/A public final Rectangle2D getBounds2D (BufferedImage src) {
0N/A return getBounds2D(src.getRaster());
0N/A }
0N/A
0N/A /**
0N/A * Returns the bounding box of the rescaled destination Raster. Since
0N/A * this is not a geometric operation, the bounding box does not
0N/A * change.
0N/A * @param src the rescaled destination <code>Raster</code>
0N/A * @return the bounds of the specified <code>Raster</code>.
0N/A */
0N/A public final Rectangle2D getBounds2D (Raster src) {
0N/A return src.getBounds();
0N/A }
0N/A
0N/A /**
0N/A * Creates a zeroed destination image with the correct size and number of
0N/A * bands.
0N/A * @param src Source image for the filter operation.
0N/A * @param destCM ColorModel of the destination. If null, the
0N/A * ColorModel of the source will be used.
0N/A * @return the zeroed-destination image.
0N/A */
0N/A public BufferedImage createCompatibleDestImage (BufferedImage src,
0N/A ColorModel destCM) {
0N/A BufferedImage image;
0N/A if (destCM == null) {
0N/A ColorModel cm = src.getColorModel();
0N/A image = new BufferedImage(cm,
0N/A src.getRaster().createCompatibleWritableRaster(),
0N/A cm.isAlphaPremultiplied(),
0N/A null);
0N/A }
0N/A else {
0N/A int w = src.getWidth();
0N/A int h = src.getHeight();
0N/A image = new BufferedImage (destCM,
0N/A destCM.createCompatibleWritableRaster(w, h),
0N/A destCM.isAlphaPremultiplied(), null);
0N/A }
0N/A
0N/A return image;
0N/A }
0N/A
0N/A /**
0N/A * Creates a zeroed-destination <code>Raster</code> with the correct
0N/A * size and number of bands, given this source.
0N/A * @param src the source <code>Raster</code>
0N/A * @return the zeroed-destination <code>Raster</code>.
0N/A */
0N/A public WritableRaster createCompatibleDestRaster (Raster src) {
0N/A return src.createCompatibleWritableRaster(src.getWidth(), src.getHeight());
0N/A }
0N/A
0N/A /**
0N/A * Returns the location of the destination point given a
0N/A * point in the source. If dstPt is non-null, it will
0N/A * be used to hold the return value. Since this is not a geometric
0N/A * operation, the srcPt will equal the dstPt.
0N/A * @param srcPt a point in the source image
0N/A * @param dstPt the destination point or <code>null</code>
0N/A * @return the location of the destination point.
0N/A */
0N/A public final Point2D getPoint2D (Point2D srcPt, Point2D dstPt) {
0N/A if (dstPt == null) {
0N/A dstPt = new Point2D.Float();
0N/A }
0N/A dstPt.setLocation(srcPt.getX(), srcPt.getY());
0N/A return dstPt;
0N/A }
0N/A
0N/A /**
0N/A * Returns the rendering hints for this op.
0N/A * @return the rendering hints of this <code>RescaleOp</code>.
0N/A */
0N/A public final RenderingHints getRenderingHints() {
0N/A return hints;
0N/A }
0N/A}