public interface Shape
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:
Shape
boundary or
Shape
boundary and the
space immediately adjacent to the
point in the increasing X
direction is
entirely inside the boundary or
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.
PathIterator
,
AffineTransform
,
FlatteningPathIterator
,
GeneralPath
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y)
Tests if the specified coordinates are inside the boundary of the
Shape , as described by the
definition of insideness. |
boolean |
contains(double x,
double y,
double w,
double h)
Tests if the interior of the
Shape entirely contains
the specified rectangular area. |
boolean |
contains(Point2D p)
Tests if a specified
Point2D is inside the boundary
of the Shape , as described by the
definition of insideness. |
boolean |
contains(Rectangle2D r)
Tests if the interior of the
Shape entirely contains the
specified Rectangle2D . |
Rectangle |
|