home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-20 | 3.9 KB | 114 lines |
- /*
- * @(#)Shape.java 1.6 98/03/18
- *
- * Copyright 1996, 1997 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
- package java.awt;
-
- import java.awt.geom.AffineTransform;
- import java.awt.geom.PathIterator;
- import java.awt.geom.Point2D;
- import java.awt.geom.Rectangle2D;
-
- /**
- * The interface for objects which represent some form of geometric
- * shape.
- * <p>
- * This interface will be revised in the upcoming Java2D project.
- * It is meant to provide a common interface for various existing
- * geometric AWT classes and methods which operate on them. Since
- * it may be superseded or expanded in the future, developers should
- * avoid implementing this interface in their own classes until it
- * is completed in a later release.
- *
- * @version 1.6 03/18/98
- * @author Jim Graham
- */
- public interface Shape {
- /**
- * Return the bounding box of the shape.
- */
- public Rectangle getBounds();
-
- /**
- * Return the high precision bounding box of the shape.
- */
- public Rectangle2D getBounds2D();
-
- /**
- * Test if a given coordinate is inside the boundary of the shape.
- */
- public boolean contains(double x, double y);
-
- /**
- * Test if a given Point is inside the boundary of the shape.
- */
- public boolean contains(Point2D p);
-
- /**
- * Test if the interior of the Shape intersects the interior of a given
- * set of rectangular coordinates.
- */
- public boolean intersects(double x, double y, double w, double h);
-
- /**
- * Test if the interior of the Shape intersects the interior of a given
- * Rectangle.
- */
- public boolean intersects(Rectangle2D r);
-
- /**
- * Test if the interior of the Shape entirely contains the given
- * set of rectangular coordinates.
- */
- public boolean contains(double x, double y, double w, double h);
-
- /**
- * Test if the interior of the Shape entirely contains the given
- * Rectangle.
- */
- public boolean contains(Rectangle2D r);
-
- /**
- * Return an iterator object that iterates along the boundary of
- * the shape and provides access to the geometry of the outline
- * of the shape.
- * An optional affine transform can be specified in which case
- * the coordinates returned in the iteration will be transformed
- * accordingly.
- * @param at an optional AffineTransform to be applied to the
- * coordinates as they are returned in the iteration, or null
- * if the untransformed coordinates are desired.
- */
- public PathIterator getPathIterator(AffineTransform at);
-
- /**
- * Return an iterator object that iterates along the boundary of
- * the shape and provides access to a flattened view of the
- * geometry of the outline of the shape.
- * Only SEG_MOVETO, SEG_LINETO, and SEG_CLOSE point types will
- * be returned by the iterator.
- * The amount of subdivision of the curved segments is controlled
- * by the <code>flatness</code> parameter which specifies ?REMIND?.
- * An optional affine transform can be specified in which case
- * the coordinates returned in the iteration will be transformed
- * accordingly.
- * @param at an optional AffineTransform to be applied to the
- * coordinates as they are returned in the iteration, or null
- * if the untransformed coordinates are desired.
- * @param flatness the maximum amount that the control points
- * for a given curve can vary from colinear before a subdivided
- * curve is replaced by a straight line connecting the endpoints.
- */
- public PathIterator getPathIterator(AffineTransform at, double flatness);
- }
-