2362N/A * Copyright (c) 1997, 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 * The <code>RoundRectangle2D</code> class defines a rectangle with 0N/A * rounded corners defined by a location {@code (x,y)}, a 0N/A * dimension {@code (w x h)}, and the width and height of an arc 0N/A * with which to round the corners. 0N/A * This class is the abstract superclass for all objects that 0N/A * store a 2D rounded rectangle. 0N/A * The actual storage representation of the coordinates is left to 0N/A * @author Jim Graham 0N/A * The <code>Float</code> class defines a rectangle with rounded 0N/A * corners all specified in <code>float</code> coordinates. 0N/A * The X coordinate of this <code>RoundRectangle2D</code>. 0N/A * The Y coordinate of this <code>RoundRectangle2D</code>. 0N/A * The width of this <code>RoundRectangle2D</code>. 0N/A * The height of this <code>RoundRectangle2D</code>. 0N/A * The width of the arc that rounds off the corners. 0N/A * The height of the arc that rounds off the corners. 0N/A * Constructs a new <code>RoundRectangle2D</code>, initialized to 0N/A * location (0.0, 0.0), size (0.0, 0.0), and corner arcs 0N/A * Constructs and initializes a <code>RoundRectangle2D</code> 0N/A * from the specified <code>float</code> coordinates. 0N/A * @param x the X coordinate of the newly 0N/A * constructed <code>RoundRectangle2D</code> 0N/A * @param y the Y coordinate of the newly 0N/A * constructed <code>RoundRectangle2D</code> 0N/A * @param w the width to which to set the newly 0N/A * constructed <code>RoundRectangle2D</code> 0N/A * @param h the height to which to set the newly 0N/A * constructed <code>RoundRectangle2D</code> 0N/A * @param arcw the width of the arc to use to round off the 0N/A * corners of the newly constructed 0N/A * <code>RoundRectangle2D</code> 0N/A * @param arch the height of the arc to use to round off the 0N/A * corners of the newly constructed 0N/A * <code>RoundRectangle2D</code> 0N/A public Float(
float x,
float y,
float w,
float h,
0N/A * Sets the location, size, and corner radii of this 0N/A * <code>RoundRectangle2D</code> to the specified 0N/A * <code>float</code> values. 0N/A * @param x the X coordinate to which to set the 0N/A * location of this <code>RoundRectangle2D</code> 0N/A * @param y the Y coordinate to which to set the 0N/A * location of this <code>RoundRectangle2D</code> 0N/A * @param w the width to which to set this 0N/A * <code>RoundRectangle2D</code> 0N/A * @param h the height to which to set this 0N/A * <code>RoundRectangle2D</code> 0N/A * @param arcw the width to which to set the arc of this 0N/A * <code>RoundRectangle2D</code> 0N/A * @param arch the height to which to set the arc of this 0N/A * <code>RoundRectangle2D</code> 0N/A * JDK 1.6 serialVersionUID 0N/A * The <code>Double</code> class defines a rectangle with rounded 0N/A * corners all specified in <code>double</code> coordinates. 0N/A * The X coordinate of this <code>RoundRectangle2D</code>. 0N/A * The Y coordinate of this <code>RoundRectangle2D</code>. 0N/A * The width of this <code>RoundRectangle2D</code>. 0N/A * The height of this <code>RoundRectangle2D</code>. 0N/A * The width of the arc that rounds off the corners. 0N/A * The height of the arc that rounds off the corners. 0N/A * Constructs a new <code>RoundRectangle2D</code>, initialized to 0N/A * location (0.0, 0.0), size (0.0, 0.0), and corner arcs 0N/A * Constructs and initializes a <code>RoundRectangle2D</code> 0N/A * from the specified <code>double</code> coordinates. 0N/A * @param x the X coordinate of the newly 0N/A * constructed <code>RoundRectangle2D</code> 0N/A * @param y the Y coordinate of the newly 0N/A * constructed <code>RoundRectangle2D</code> 0N/A * @param w the width to which to set the newly 0N/A * constructed <code>RoundRectangle2D</code> 0N/A * @param h the height to which to set the newly 0N/A * constructed <code>RoundRectangle2D</code> 0N/A * @param arcw the width of the arc to use to round off the 0N/A * corners of the newly constructed 0N/A * <code>RoundRectangle2D</code> 0N/A * @param arch the height of the arc to use to round off the 0N/A * corners of the newly constructed 0N/A * <code>RoundRectangle2D</code> 0N/A public Double(
double x,
double y,
double w,
double h,
0N/A * JDK 1.6 serialVersionUID 0N/A * This is an abstract class that cannot be instantiated directly. 0N/A * Type-specific implementation subclasses are available for 0N/A * instantiation and provide a number of formats for storing 0N/A * the information necessary to satisfy the various accessor 0N/A * @see java.awt.geom.RoundRectangle2D.Float 0N/A * @see java.awt.geom.RoundRectangle2D.Double 0N/A * Gets the width of the arc that rounds off the corners. 0N/A * @return the width of the arc that rounds off the corners 0N/A * of this <code>RoundRectangle2D</code>. 0N/A * Gets the height of the arc that rounds off the corners. 0N/A * @return the height of the arc that rounds off the corners 0N/A * of this <code>RoundRectangle2D</code>. 0N/A * Sets the location, size, and corner radii of this 0N/A * <code>RoundRectangle2D</code> to the specified 0N/A * <code>double</code> values. 0N/A * @param x the X coordinate to which to set the 0N/A * location of this <code>RoundRectangle2D</code> 0N/A * @param y the Y coordinate to which to set the 0N/A * location of this <code>RoundRectangle2D</code> 0N/A * @param w the width to which to set this 0N/A * <code>RoundRectangle2D</code> 0N/A * @param h the height to which to set this 0N/A * <code>RoundRectangle2D</code> 0N/A * @param arcWidth the width to which to set the arc of this 0N/A * <code>RoundRectangle2D</code> 0N/A * @param arcHeight the height to which to set the arc of this 0N/A * <code>RoundRectangle2D</code> 0N/A * Sets this <code>RoundRectangle2D</code> to be the same as the 0N/A * specified <code>RoundRectangle2D</code>. 0N/A * @param rr the specified <code>RoundRectangle2D</code> 0N/A public void setFrame(
double x,
double y,
double w,
double h) {
0N/A // Check for trivial rejection - point is outside bounding rectangle 0N/A // Check which corner point is in and do circular containment 0N/A // test - otherwise simple acceptance 0N/A return (x * x + y * y <=
1.0);
0N/A public boolean intersects(
double x,
double y,
double w,
double h) {
0N/A // Check for trivial rejection - bounding rectangles do not intersect 0N/A // Trivially accept if any point is inside inner rectangle 0N/A // Trivially accept if either edge spans inner rectangle 0N/A // Since neither edge spans the center, then one of the corners 0N/A // must be in one of the rounded edges. We detect this case if 0N/A // a [xy]0class is 3 or a [xy]1class is 1. One of those two cases 0N/A // must be true for each direction. 0N/A // We now find a "nearest point" to test for being inside a rounded 0N/A return (x * x + y * y <=
1.0);
0N/A public boolean contains(
double x,
double y,
double w,
double h) {
0N/A * Returns an iteration object that defines the boundary of this 0N/A * <code>RoundRectangle2D</code>. 0N/A * The iterator for this class is multi-threaded safe, which means 0N/A * that this <code>RoundRectangle2D</code> class guarantees that 0N/A * modifications to the geometry of this <code>RoundRectangle2D</code> 0N/A * object do not affect any iterations of that geometry that 0N/A * are already in process. 0N/A * @param at an optional <code>AffineTransform</code> to be applied to 0N/A * the coordinates as they are returned in the iteration, or 0N/A * <code>null</code> if untransformed coordinates are desired 0N/A * @return the <code>PathIterator</code> object that returns the 0N/A * geometry of the outline of this 0N/A * <code>RoundRectangle2D</code>, one segment at a time. 0N/A * Returns the hashcode for this <code>RoundRectangle2D</code>. 0N/A * @return the hashcode for this <code>RoundRectangle2D</code>. 0N/A * Determines whether or not the specified <code>Object</code> is 0N/A * equal to this <code>RoundRectangle2D</code>. The specified 0N/A * <code>Object</code> is equal to this <code>RoundRectangle2D</code> 0N/A * if it is an instance of <code>RoundRectangle2D</code> and if its 0N/A * location, size, and corner arc dimensions are the same as this 0N/A * <code>RoundRectangle2D</code>. 0N/A * @param obj an <code>Object</code> to be compared with this 0N/A * <code>RoundRectangle2D</code>. 0N/A * @return <code>true</code> if <code>obj</code> is an instance 0N/A * of <code>RoundRectangle2D</code> and has the same values; 0N/A * <code>false</code> otherwise.