2362N/A * Copyright (c) 2002, 2007, 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 0N/A * This file provides a number of structures, macros, and C functions 0N/A * for native code to use to iterate through the list of rectangles 0N/A * included in a Java Region object. The intended usage pattern should 0N/A * comply with the following code sample: 0N/A * RegionData rgnInfo; 0N/A * Region_GetInfo(env, javaregion, &rgnInfo); 0N/A * // Calculate the area of interest for the graphics operation. 0N/A * Region_IntersectBounds(&rgnInfo, lox, loy, hix, hiy); 0N/A * if (!Region_IsEmpty(&rgnInfo)) { 0N/A * If (Region_IsRectangular(&rgnInfo)) { 0N/A * // Optional code optimized for a single rectangle 0N/A * SurfaceDataBounds span; 0N/A * Region_StartIteration(env, &rgnInfo); 0N/A * // this next line is optional if the info is needed 0N/A * int numrects = Region_CountIterationRects(&rgnInfo); 0N/A * while (Region_NextIteration(&rgnInfo, &span)) { 0N/A * // Process span.x1, span.y1, span.x2, span.y2 0N/A * Region_EndIteration(env, &rgnInfo); 0N/A * This structure is not meant to be accessed by code outside of 0N/A * stack-allocate one of these structures for performance. 0N/A * Initialize a native RegionData structure from a Java object 0N/A * This function may use JNI methods so it is important that the 0N/A * caller not have any outstanding GetPrimitiveArrayCritical or 0N/A * GetStringCritical locks which have not been released. 0N/A * This function retrieves the bounds from a Java Region object and 0N/A * returns them in the specified SurfaceDataBounds structure. 0N/A * This function may use JNI methods so it is important that the 0N/A * caller not have any outstanding GetPrimitiveArrayCritical or 0N/A * GetStringCritical locks which have not been released. 0N/A * Intersect the specified SurfaceDataBounds with the bounds of 0N/A * the indicated RegionData structure. The Region iteration will 0N/A * subsequently honor those bounds. 0N/A * Intersect the specified bounding coordinates with the bounds of 0N/A * the indicated RegionData structure. The Region iteration will 0N/A * subsequently honor those bounds. 0N/A * Test whether the bounds of the specified RegionData structure 0N/A * are now trivially empty. 0N/A * Note that this test only checks the overall bounds of the Region 0N/A * and does not check to see if there are any individual subrectangles 0N/A * which make up the region that intersect the current bounds. 0N/A * Typically a Java Region object will have tight bounds that reflects 0N/A * a non-empty set of subrectangles in the list, but after a given 0N/A * graphics operation has intersected the RegionData with the area 0N/A * of interest for that operation using one of the above calls to 0N/A * IntersectBounds, the new bounds may fail to intersect any of 0N/A * the subrectangles. 0N/A * Test whether the RegionData structure represents a single rectangle. 0N/A * Note that this test only checks to see if the original Java Region 0N/A * object is a simple rectangle and does not take into account the 0N/A * subsetting of the list of rectangles that might occur if a given 0N/A * graphics operation intersects the bounds with an area of interest. 0N/A * Initialize a given RegionData structure for iteration of the 0N/A * list of subrectangles. This operation can be performed on 0N/A * empty regions, simple rectangular regions and complex regions 0N/A * without loss of generality. 0N/A * This function may use JNI Critical methods so it is important 0N/A * that the caller not call any other JNI methods after this function 0N/A * returns until the RegionEndIteration function is called. 0N/A * Count the number of subrectangles in the indicated RegionData. 0N/A * The subrectangles will be compared against the bounds of the 0N/A * Region so only those subrectangles that intersect the area of 0N/A * interest will be included in the returned count. 0N/A * This function may only be called after Region_StartIteration 0N/A * and before Region_EndIteration are called on a given RegionData 0N/A * Process the list of subrectangles in the RegionData structure and 0N/A * assign the bounds of that subrectangle to the pSpan structure and 0N/A * return a non-zero return value if one exists. If there are no 0N/A * more subrectangles in the given area of interest specified by 0N/A * the bounds of the RegionData structure, then return 0. 0N/A * This function may only be called after Region_StartIteration 0N/A * and before Region_EndIteration are called on a given RegionData 0N/A * Uninitialize a RegionData structure and discard any information 0N/A * that was needed to iterate the list of subrectangles. 0N/A * This function will release any outstanding JNI Critical locks so 0N/A * it will once again be safe to use arbitrary JNI calls or return 0N/A * to the enclosing JNI native context. 0N/A * Converts a sun.java2d.pipe.Region object to a list of 0N/A * rectangles using platform specific native data representation