java.awt

Interface Shape

  • All Known Implementing Classes:
    Polygon, Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.RectangularShape
    public interface Shape
    The Shape interface provides definitions for objects that represent some form of geometric shape. The Shape is described by a PathIterator object, which can express the outline of the Shape as well as a rule for determining how the outline divides the 2D plane into interior and exterior points. Each Shape object provides callbacks to get the bounding box of the geometry, determine whether points or rectangles lie partly or entirely within the interior of the Shape, and retrieve a PathIterator object that describes the trajectory path of the Shape outline.

    Definition of insideness: A point is considered to lie inside a Shape if and only if:

    • it lies completely inside theShape boundary or
    • it lies exactly on the Shape boundary and the space immediately adjacent to the point in the increasing X direction is entirely inside the boundary or
    • it lies exactly on a horizontal boundary segment and the space immediately adjacent to the point in the increasing Y direction is inside the boundary.

    The contains and intersects methods consider the interior of a Shape to be the area it encloses as if it were filled. This means that these methods consider unclosed shapes to be implicitly closed for the purpose of determining if a shape contains or intersects a rectangle or if a shape contains a point.

    Since:
    1.2
    See Also:
    PathIterator, AffineTransform, FlatteningPathIterator, GeneralPath
    • Methods 
      Modifier and Type Method and Description
      Ordinary member indicator contains Reveal DetailHide Detail
      Tests if the specified coordinates are inside the boundary of the Shape, as described by the definition of insideness.
      Ordinary member indicator contains Reveal DetailHide Detail
      Tests if the interior of the Shape entirely contains the specified rectangular area.
      Ordinary member indicator contains Reveal DetailHide Detail
      Tests if a specified Point2D is inside the boundary of the Shape, as described by the definition of insideness.
      Ordinary member indicator contains Reveal DetailHide Detail
      Tests if the interior of the Shape entirely contains the specified Rectangle2D.
      Ordinary member indicator getBounds Reveal DetailHide Detail
      Returns an integer Rectangle that completely encloses the Shape.
      Ordinary member indicator getBounds2D Reveal DetailHide Detail
      Returns a high precision and more accurate bounding box of the Shape than the getBounds method.
      Ordinary member indicator getPathIterator Reveal DetailHide Detail
      Returns an iterator object that iterates along the Shape boundary and provides access to the geometry of the Shape outline.
      Ordinary member indicator getPathIterator Reveal DetailHide Detail
      Returns an iterator object that iterates along the Shape boundary and provides access to a flattened view of the Shape outline geometry.
      Ordinary member indicator intersects Reveal DetailHide Detail
      Tests if the interior of the Shape intersects the interior of a specified rectangular area.
      Ordinary member indicator intersects Reveal DetailHide Detail
      Tests if the interior of the Shape intersects the interior of a specified Rectangle2D.
This document was created by Dulcet from the OpenJDK sources. Copyright © 1993, 2012 Oracle and/or its affiliates. All rights reserved.

SourceForge