2362N/A * Copyright (c) 1998, 2006, 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 encapsulates a definition of a two dimensional region which 0N/A * consists of a number of Y ranges each containing multiple X bands. 0N/A * A rectangular Region is allowed to have a null band list in which 0N/A * case the rectangular shape is defined by the bounding box parameters 0N/A * (lox, loy, hix, hiy). 0N/A * The band list, if present, consists of a list of rows in ascending Y 0N/A * order, ending at endIndex which is the index beyond the end of the 0N/A * last row. Each row consists of at least 3 + 2n entries (n >= 1) 0N/A * where the first 3 entries specify the Y range as start, end, and 0N/A * the number of X ranges in that Y range. These 3 entries are 0N/A * followed by pairs of X coordinates in ascending order: 0N/A * bands[rowstart+0] = Y0; // starting Y coordinate 0N/A * bands[rowstart+1] = Y1; // ending Y coordinate - endY > startY 0N/A * bands[rowstart+2] = N; // number of X bands - N >= 1 0N/A * bands[rowstart+3] = X10; // starting X coordinate of first band 0N/A * bands[rowstart+4] = X11; // ending X coordinate of first band 0N/A * bands[rowstart+5] = X20; // starting X coordinate of second band 0N/A * bands[rowstart+6] = X21; // ending X coordinate of second band 0N/A * bands[rowstart+3+N*2-2] = XN0; // starting X coord of last band 0N/A * bands[rowstart+3+N*2-1] = XN1; // ending X coord of last band 0N/A * bands[rowstart+3+N*2] = ... // start of next Y row 886N/A // Override all the methods that mutate the object 0N/A * Adds the dimension <code>dim</code> to the coordinate 0N/A * <code>start</code> with appropriate clipping. If 0N/A * <code>dim</code> is non-positive then the method returns 0N/A * the start coordinate. If the sum overflows an integer 0N/A * data type then the method returns <code>Integer.MAX_VALUE</code>. 0N/A * Adds the delta {@code dv} to the value {@code v} with 0N/A * appropriate clipping to the bounds of Integer resolution. 0N/A * If the answer would be greater than {@code Integer.MAX_VALUE} 0N/A * then {@code Integer.MAX_VALUE} is returned. 0N/A * If the answer would be less than {@code Integer.MIN_VALUE} 0N/A * then {@code Integer.MIN_VALUE} is returned. 0N/A * Otherwise the sum is returned. 6084N/A * Multiply the scale factor {@code sv} and the value {@code v} with 6084N/A * appropriate clipping to the bounds of Integer resolution. If the answer 6084N/A * would be greater than {@code Integer.MAX_VALUE} then {@code 6084N/A * Integer.MAX_VALUE} is returned. If the answer would be less than {@code 6084N/A * Integer.MIN_VALUE} then {@code Integer.MIN_VALUE} is returned. Otherwise 6084N/A * the multiplication is returned. 0N/A * Returns a Region object covering the pixels which would be 0N/A * touched by a fill or clip operation on a Graphics implementation 0N/A * on the specified Shape object under the optionally specified 0N/A * AffineTransform object. 0N/A * @param s a non-null Shape object specifying the geometry enclosing 0N/A * the pixels of interest 0N/A * @param at an optional <code>AffineTransform</code> to be applied to the 0N/A * coordinates as they are returned in the iteration, or 0N/A * <code>null</code> if untransformed coordinates are desired 0N/A * Returns a Region object covering the pixels which would be 0N/A * touched by a fill or clip operation on a Graphics implementation 0N/A * on the specified Shape object under the optionally specified 0N/A * AffineTransform object further restricted by the specified 0N/A * Note that only the bounds of the specified Region are used to 0N/A * restrict the resulting Region. 0N/A * If devBounds is non-rectangular and clipping to the specific 0N/A * bands of devBounds is needed, then an intersection of the 0N/A * resulting Region with devBounds must be performed in a 0N/A * @param devBounds a non-null Region specifying some bounds to 0N/A * clip the geometry to 0N/A * @param s a non-null Shape object specifying the geometry enclosing 0N/A * the pixels of interest 0N/A * @param at an optional <code>AffineTransform</code> to be applied to the 0N/A * coordinates as they are returned in the iteration, or 0N/A * <code>null</code> if untransformed coordinates are desired 0N/A * Returns a Region object covering the pixels which would be 0N/A * touched by a fill or clip operation on a Graphics implementation 0N/A * on the specified Shape object under the optionally specified 0N/A * AffineTransform object further restricted by the specified 0N/A * If the normalize parameter is true then coordinate normalization 0N/A * is performed as per the 2D Graphics non-antialiasing implementation 0N/A * of the VALUE_STROKE_NORMALIZE hint. 0N/A * Note that only the bounds of the specified Region are used to 0N/A * restrict the resulting Region. 0N/A * If devBounds is non-rectangular and clipping to the specific 0N/A * bands of devBounds is needed, then an intersection of the 0N/A * resulting Region with devBounds must be performed in a 0N/A * @param devBounds a non-null Region specifying some bounds to 0N/A * clip the geometry to 0N/A * @param normalize a boolean indicating whether or not to apply 0N/A * @param s a non-null Shape object specifying the geometry enclosing 0N/A * the pixels of interest 0N/A * @param at an optional <code>AffineTransform</code> to be applied to the 0N/A * coordinates as they are returned in the iteration, or 0N/A * <code>null</code> if untransformed coordinates are desired 886N/A // Optimize for empty shapes to avoid involving the SpanIterator 0N/A * Returns a Region object with a rectangle of interest specified 0N/A * by the indicated Rectangle object. 0N/A * This method can also be used to create a simple rectangular 0N/A * Returns a Region object with a rectangle of interest specified 0N/A * by the indicated rectangular area in x, y, width, height format. 0N/A * This method can also be used to create a simple rectangular 0N/A * Returns a Region object with a rectangle of interest specified 0N/A * by the indicated span array. 0N/A * This method can also be used to create a simple rectangular 0N/A * Returns a Region object with a rectangle of interest specified 0N/A * by the indicated rectangular area in lox, loy, hix, hiy format. 0N/A * This method can also be used to create a simple rectangular 0N/A * Sets the rectangle of interest for storing and returning 0N/A * This method can also be used to initialize a simple rectangular 0N/A * Sets the rectangle of interest for storing and returning 0N/A * region bands. The rectangle is specified in x, y, width, height 0N/A * format and appropriate clipping is performed as per the method 0N/A * <code>dimAdd</code>. 0N/A * This method can also be used to initialize a simple rectangular 0N/A * Sets the rectangle of interest for storing and returning 0N/A * region bands. The rectangle is specified as a span array. 0N/A * This method can also be used to initialize a simple rectangular 0N/A * Sets the rectangle of interest for storing and returning 0N/A * region bands. The rectangle is specified in lox, loy, 0N/A * This method can also be used to initialize a simple rectangular 0N/A * Appends the list of spans returned from the indicated 0N/A * SpanIterator. Each span must be at a higher starting 0N/A * Y coordinate than the previous data or it must have a 0N/A * Y range equal to the highest Y band in the region and a 0N/A * higher X coordinate than any of the spans in that band. 6084N/A * Returns a Region object that represents the same list of rectangles as 6084N/A * the current Region object, scaled by the specified sx, sy factors. 6084N/A int i =
0;
// index for source bands 6084N/A int j =
0;
// index for translated newbands 6084N/A // Did we get any non-empty bands in this row? 6084N/A // No rows or bands were generated... 6084N/A // Only generated one single rect in the end... 6084N/A // ret.endIndex and ret.bands were never initialized... 0N/A * Returns a Region object that represents the same list of 0N/A * rectangles as the current Region object, translated by 0N/A * the specified dx, dy translation factors. 0N/A int i =
0;
// index for source bands 0N/A int j =
0;
// index for translated newbands 0N/A // Did we get any non-empty bands in this row? 0N/A // No rows or bands were generated... 0N/A // Only generated one single rect in the end... 0N/A // ret.endIndex and ret.bands were never initialized... 0N/A // ret.endIndex = 0; 0N/A // ret.newbands = null; 0N/A // Generated multiple bands and/or multiple rows... 0N/A * Returns a Region object that represents the intersection of 0N/A * this object with the specified Rectangle. The return value 0N/A * may be this same object if no clipping occurs. 0N/A * Returns a Region object that represents the intersection of 0N/A * this object with the specified rectangular area. The return 0N/A * value may be this same object if no clipping occurs. 0N/A * Returns a Region object that represents the intersection of 0N/A * this object with the specified rectangular area. The return 0N/A * value may be this same object if no clipping occurs. 0N/A * Returns a Region object that represents the intersection of this 0N/A * object with the specified Region object. 0N/A * If {@code A} and {@code B} are both Region Objects and 0N/A * <code>C = A.getIntersection(B);</code> then a point will 0N/A * be contained in {@code C} iff it is contained in both 0N/A * {@code A} and {@code B}. 0N/A * The return value may be this same object or the argument 0N/A * Region object if no clipping occurs. 0N/A * Returns a Region object that represents the union of this 0N/A * object with the specified Region object. 0N/A * If {@code A} and {@code B} are both Region Objects and 0N/A * <code>C = A.getUnion(B);</code> then a point will 0N/A * be contained in {@code C} iff it is contained in either 0N/A * {@code A} or {@code B}. 0N/A * The return value may be this same object or the argument 0N/A * Region object if no augmentation occurs. 0N/A * Returns a Region object that represents the difference of the 0N/A * specified Region object subtracted from this object. 0N/A * If {@code A} and {@code B} are both Region Objects and 0N/A * <code>C = A.getDifference(B);</code> then a point will 0N/A * be contained in {@code C} iff it is contained in 0N/A * {@code A} but not contained in {@code B}. 0N/A * The return value may be this same object or the argument 0N/A * Region object if no clipping occurs. 0N/A * Returns a Region object that represents the exclusive or of this 0N/A * object with the specified Region object. 0N/A * If {@code A} and {@code B} are both Region Objects and 0N/A * <code>C = A.getExclusiveOr(B);</code> then a point will 0N/A * be contained in {@code C} iff it is contained in either 0N/A * {@code A} or {@code B}, but not if it is contained in both. 0N/A * The return value may be this same object or the argument 0N/A * Region object if either is empty. 0N/A // We are in a set of rows that belong only to A 0N/A // We are in a set of rows that belong only to B 0N/A // We are in a set of rows that belong to both A and B 0N/A * Returns a Region object that represents the bounds of the 0N/A * intersection of this object with the bounds of the specified 0N/A * The return value may be this same object if no clipping occurs 0N/A * and this Region is rectangular. 0N/A * Returns a Region object that represents the bounds of the 0N/A * intersection of this object with the bounds of the specified 0N/A * rectangular area in x, y, width, height format. 0N/A * The return value may be this same object if no clipping occurs 0N/A * and this Region is rectangular. 0N/A * Returns a Region object that represents the bounds of the 0N/A * intersection of this object with the bounds of the specified 0N/A * rectangular area in lox, loy, hix, hiy format. 0N/A * The return value may be this same object if no clipping occurs 0N/A * and this Region is rectangular. 0N/A * Returns a Region object that represents the intersection of 0N/A * this object with the bounds of the specified Region object. 0N/A * The return value may be this same object or the argument 0N/A * Region object if no clipping occurs and the Regions are 0N/A * Appends a single span defined by the 4 parameters 0N/A * spanlox, spanloy, spanhix, spanhiy. 0N/A * This span must be at a higher starting Y coordinate than 0N/A * the previous data or it must have a Y range equal to the 0N/A * highest Y band in the region and a higher X coordinate 0N/A * than any of the spans in that band. 0N/A * Returns the lowest X coordinate in the Region. 0N/A * Returns the lowest Y coordinate in the Region. 0N/A * Returns the highest X coordinate in the Region. 0N/A * Returns the highest Y coordinate in the Region. 0N/A * Returns the width of this Region clipped to the range (0 - MAX_INT). 0N/A * Returns the height of this Region clipped to the range (0 - MAX_INT). 0N/A * Returns true iff this Region encloses no area. 0N/A * Returns true iff this Region represents a single simple 0N/A * Returns true iff this Region contains the specified coordinate. 0N/A * Returns true iff this Region lies inside the indicated 0N/A * rectangular area specified in x, y, width, height format 0N/A * with appropriate clipping performed as per the dimAdd method. 0N/A * Returns true iff this Region lies inside the indicated 0N/A * rectangular area specified in lox, loy, hix, hiy format. 0N/A * Quickly checks if this Region lies inside the specified 0N/A * This method will return false if the specified Region 0N/A * object is not a simple rectangle. 0N/A * Quickly checks if this Region intersects the specified 0N/A * rectangular area specified in lox, loy, hix, hiy format. 0N/A * This method tests only against the bounds of this region 0N/A * and does not bother to test if the rectangular region 0N/A * actually intersects any bands. 0N/A * Quickly checks if this Region intersects the specified 0N/A * This method tests only against the bounds of this region 0N/A * and does not bother to test if the rectangular region 0N/A * actually intersects any bands. 0N/A * Quickly checks if this Region surrounds the specified 0N/A * This method will return false if this Region object is 0N/A * not a simple rectangle. 0N/A * Quickly checks if this Region surrounds the specified 0N/A * rectangular area specified in x, y, width, height format. 0N/A * This method will return false if this Region object is 0N/A * not a simple rectangle. 0N/A * Quickly checks if this Region surrounds the specified 0N/A * rectangular area specified in lox, loy, hix, hiy format. 0N/A * This method will return false if this Region object is 0N/A * not a simple rectangle. 0N/A * Gets the bbox of the available spans, clipped to the OutputArea. 0N/A * Clips the indicated bbox array to the bounds of this Region. 0N/A * Gets an iterator object to iterate over the spans in this region. 0N/A * Gets a span iterator object that iterates over the spans in this region 0N/A * Gets a span iterator object that iterates over the spans in this region 0N/A * but clipped to the bounds given in the argument (xlo, ylo, xhi, yhi). 0N/A * Returns a SpanIterator that is the argument iterator filtered by