home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / awt / Shape.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  3.9 KB  |  114 lines

  1. /*
  2.  * @(#)Shape.java    1.6 98/03/18
  3.  *
  4.  * Copyright 1996, 1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.awt;
  16.  
  17. import java.awt.geom.AffineTransform;
  18. import java.awt.geom.PathIterator;
  19. import java.awt.geom.Point2D;
  20. import java.awt.geom.Rectangle2D;
  21.  
  22. /**
  23.  * The interface for objects which represent some form of geometric
  24.  * shape.
  25.  * <p>
  26.  * This interface will be revised in the upcoming Java2D project.
  27.  * It is meant to provide a common interface for various existing
  28.  * geometric AWT classes and methods which operate on them.  Since
  29.  * it may be superseded or expanded in the future, developers should
  30.  * avoid implementing this interface in their own classes until it
  31.  * is completed in a later release.
  32.  *
  33.  * @version 1.6 03/18/98
  34.  * @author Jim Graham
  35.  */
  36. public interface Shape {
  37.     /**
  38.      * Return the bounding box of the shape.
  39.      */
  40.     public Rectangle getBounds();
  41.  
  42.     /**
  43.      * Return the high precision bounding box of the shape.
  44.      */
  45.     public Rectangle2D getBounds2D();
  46.  
  47.     /**
  48.      * Test if a given coordinate is inside the boundary of the shape.
  49.      */
  50.     public boolean contains(double x, double y);
  51.  
  52.     /**
  53.      * Test if a given Point is inside the boundary of the shape.
  54.      */
  55.     public boolean contains(Point2D p);
  56.  
  57.     /**
  58.      * Test if the interior of the Shape intersects the interior of a given
  59.      * set of rectangular coordinates.
  60.      */
  61.     public boolean intersects(double x, double y, double w, double h);
  62.  
  63.     /**
  64.      * Test if the interior of the Shape intersects the interior of a given
  65.      * Rectangle.
  66.      */
  67.     public boolean intersects(Rectangle2D r);
  68.  
  69.     /**
  70.      * Test if the interior of the Shape entirely contains the given
  71.      * set of rectangular coordinates.
  72.      */
  73.     public boolean contains(double x, double y, double w, double h);
  74.  
  75.     /**
  76.      * Test if the interior of the Shape entirely contains the given
  77.      * Rectangle.
  78.      */
  79.     public boolean contains(Rectangle2D r);
  80.  
  81.     /**
  82.      * Return an iterator object that iterates along the boundary of
  83.      * the shape and provides access to the geometry of the outline
  84.      * of the shape.
  85.      * An optional affine transform can be specified in which case
  86.      * the coordinates returned in the iteration will be transformed
  87.      * accordingly.
  88.      * @param at an optional AffineTransform to be applied to the
  89.      * coordinates as they are returned in the iteration, or null
  90.      * if the untransformed coordinates are desired.
  91.      */
  92.     public PathIterator getPathIterator(AffineTransform at);
  93.  
  94.     /**
  95.      * Return an iterator object that iterates along the boundary of
  96.      * the shape and provides access to a flattened view of the
  97.      * geometry of the outline of the shape.
  98.      * Only SEG_MOVETO, SEG_LINETO, and SEG_CLOSE point types will
  99.      * be returned by the iterator.
  100.      * The amount of subdivision of the curved segments is controlled
  101.      * by the <code>flatness</code> parameter which specifies ?REMIND?.
  102.      * An optional affine transform can be specified in which case
  103.      * the coordinates returned in the iteration will be transformed
  104.      * accordingly.
  105.      * @param at an optional AffineTransform to be applied to the
  106.      * coordinates as they are returned in the iteration, or null
  107.      * if the untransformed coordinates are desired.
  108.      * @param flatness the maximum amount that the control points
  109.      * for a given curve can vary from colinear before a subdivided
  110.      * curve is replaced by a straight line connecting the endpoints.
  111.      */
  112.     public PathIterator getPathIterator(AffineTransform at, double flatness);
  113. }
  114.