2362N/A * Copyright (c) 1995, 2004, 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 * An ImageFilter class for cropping images. 0N/A * This class extends the basic ImageFilter Class to extract a given 0N/A * rectangular region of an existing Image and provide a source for a 0N/A * new image containing just the extracted region. It is meant to 0N/A * be used in conjunction with a FilteredImageSource object to produce 0N/A * cropped versions of existing images. 0N/A * @see FilteredImageSource 0N/A * @author Jim Graham 0N/A * Constructs a CropImageFilter that extracts the absolute rectangular 0N/A * region of pixels from its source Image as specified by the x, y, 0N/A * w, and h parameters. 0N/A * @param x the x location of the top of the rectangle to be extracted 0N/A * @param y the y location of the top of the rectangle to be extracted 0N/A * @param w the width of the rectangle to be extracted 0N/A * @param h the height of the rectangle to be extracted 0N/A * Passes along the properties from the source object after adding a 0N/A * property indicating the cropped region. 0N/A * This method invokes <code>super.setProperties</code>, 0N/A * which might result in additional properties being added. 0N/A * Note: This method is intended to be called by the 0N/A * <code>ImageProducer</code> of the <code>Image</code> whose pixels 0N/A * are being filtered. Developers using 0N/A * this class to filter pixels from an image should avoid calling 0N/A * this method directly since that operation could interfere 0N/A * with the filtering operation. 0N/A * Override the source image's dimensions and pass the dimensions 0N/A * of the rectangular cropped region to the ImageConsumer. 0N/A * Note: This method is intended to be called by the 0N/A * <code>ImageProducer</code> of the <code>Image</code> whose 0N/A * pixels are being filtered. Developers using 0N/A * this class to filter pixels from an image should avoid calling 0N/A * this method directly since that operation could interfere 0N/A * with the filtering operation. 0N/A * @see ImageConsumer 0N/A * Determine whether the delivered byte pixels intersect the region to 0N/A * be extracted and passes through only that subset of pixels that 0N/A * appear in the output region. 0N/A * Note: This method is intended to be called by the 0N/A * <code>ImageProducer</code> of the <code>Image</code> whose 0N/A * pixels are being filtered. Developers using 0N/A * this class to filter pixels from an image should avoid calling 0N/A * this method directly since that operation could interfere 0N/A * with the filtering operation. 0N/A * Determine if the delivered int pixels intersect the region to 0N/A * be extracted and pass through only that subset of pixels that 0N/A * appear in the output region. 0N/A * Note: This method is intended to be called by the 0N/A * <code>ImageProducer</code> of the <code>Image</code> whose 0N/A * pixels are being filtered. Developers using 0N/A * this class to filter pixels from an image should avoid calling 0N/A * this method directly since that operation could interfere 0N/A * with the filtering operation. 0N/A //check for potential overflow (see bug 4801285) 0N/A if ( x >
0 && w >
0 &&
x2 <
0 ) {
0N/A }
else if( x <
0 && w <
0 &&
x2 >
0 ) {