Path2D class provides a simple, yet flexible
shape which represents an arbitrary geometric path.
It can fully represent any path which can be iterated by the
PathIterator interface including all of its segment
types and winding rules and it implements all of the
basic hit testing methods of the Shape interface.
Use Path2D. when dealing with data that can be represented
and used with floating point precision. Use Path2D.
for data that requires the accuracy or range of double precision.
Path2D provides exactly those facilities required for
basic construction and management of a geometric path and
implementation of the above interfaces with little added
interpretation.
If it is useful to manipulate the interiors of closed
geometric shapes beyond simple hit testing then the
Area class provides additional capabilities
specifically targeted at closed figures.
While both classes nominally implement the Shape
interface, they differ in purpose and together they provide
two useful views of a geometric shape where Path2D
deals primarily with a trajectory formed by path segments
and Area deals more with interpretation and manipulation
of enclosed regions of 2D geometric space.
The PathIterator interface has more detailed descriptions
of the types of segments that make up a path and the winding rules
that control how to determine which regions are inside or outside
the path.
| Modifier and Type | Class and Description |
|---|---|
| public static class | Path2D.
The |
| public static class | Path2D.
The |
| pack-priv abstract static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv transient int | |
| pack-priv transient int | |
| pack-priv transient byte[] | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| public static final int | WIND_EVEN_ODD
An even-odd winding rule for determining the interior of a path. |
| public static final int | WIND_NON_ZERO
A non-zero winding rule for determining the interior of a path. |
| pack-priv transient int |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | Path2D(int
the winding rule rule, int the size to make the initial array to
store the path segment types initialTypes)Constructs a new |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv abstract void | |
| pack-priv abstract void | |
| public final void | append(Shape
the s, boolean Shape whose geometry is appended
to this patha boolean to control whether or not to turn an initial
connect)moveTo segment into a lineTo segment
to connect the new geometry to the existing pathAppends the geometry of the specified |
| public abstract void | append(PathIterator
the pi, boolean PathIterator whose geometry is appended to
this patha boolean to control whether or not to turn an initial
connect)moveTo segment into a lineTo segment
to connect the new geometry to the existing pathAppends the geometry of the specified
|
| public abstract Object | Returns: a clone of this instance.Overrides java. Creates a new object of the same class as this object. |
| pack-priv abstract double[] | |
| pack-priv abstract float[] | |
| public final synchronized void | closePath()
Closes the current subpath by drawing a straight line back to
the coordinates of the last |
| public static boolean | Returns: true if the specified coordinates are inside the
specified PathIterator; false otherwisethe specified pi, double PathIteratorthe specified X coordinate x, double the specified Y coordinate y)Tests if the specified coordinates are inside the closed
boundary of the specified |
| public static boolean | Returns: true if the specified coordinates are inside the
specified PathIterator; false otherwisethe specified pi, Point2D PathIteratorthe specified p)Point2DTests if the specified |
| public final boolean | contains(double x, double y)
Implements java. Tests if the specified coordinates are inside the boundary of the
|
| public final boolean | contains(Point2D p)
Implements java. Tests if a specified |
| public static boolean | Returns: true if the specified PathIterator contains
the specified rectangular area; false otherwise.the specified pi, double PathIteratorthe specified X coordinate x, double the specified Y coordinate y, double the width of the specified rectangular area w, double the height of the specified rectangular area h)Tests if the specified rectangular area is entirely inside the
closed boundary of the specified |
| public static boolean | Returns: true if the specified PathIterator contains
the specified Rectangle2D; false otherwise.the specified pi, Rectangle2D PathIteratora specified r)Rectangle2DTests if the specified |
| public final boolean | contains(double x, double y, double w, double h)
Implements java. Tests if the interior of the |
| public final boolean | contains(Rectangle2D r)
Implements java. Tests if the interior of the |
| public final synchronized Shape | Returns: a newShape, transformed with the specified
AffineTransform.the at)AffineTransform used to transform a
new Shape.Returns a new |
| public abstract void | curveTo(double
the X coordinate of the first Bézier control point x1, double the Y coordinate of the first Bézier control point y1, double the X coordinate of the second Bézier control point x2, double the Y coordinate of the second Bézier control point y2, double the X coordinate of the final end point x3, double the Y coordinate of the final end point y3)Adds a curved segment, defined by three new points, to the path by
drawing a Bézier curve that intersects both the current
coordinates and the specified coordinates |
| pack-priv static byte[] | |
| public final Rectangle | getBounds()
Implements java. Returns an integer |
| pack-priv static Rectangle2D | Returns: an instance ofRectangle2D that is a high-precision bounding box of the
PathIterator.the specified pi)PathIteratorReturns a high precision bounding box of the specified PathIterator. |
| public final synchronized Point2D | Returns: aPoint2D object containing the ending coordinates of
the path or null if there are no points in the path.Returns the coordinates most recently added to the end of the path
as a |
| public final PathIterator | getPathIterator(AffineTransform at, double flatness)
Implements java. Returns an iterator object that iterates along the |
| pack-priv abstract Point2D | |
| public final synchronized int | Returns: an integer representing the current winding rule.Returns the fill style winding rule. |
| public static boolean | Returns: true if the specified PathIterator and
the interior of the specified set of rectangular
coordinates intersect each other; false otherwise.the specified pi, double PathIteratorthe specified X coordinate x, double the specified Y coordinate y, double the width of the specified rectangular coordinates w, double the height of the specified rectangular coordinates h)Tests if the interior of the specified |
| public static boolean | Returns: true if the specified PathIterator and
the interior of the specified Rectangle2D
intersect each other; false otherwise.the specified pi, Rectangle2D PathIteratorthe specified r)Rectangle2DTests if the interior of the specified |
| public final boolean | intersects(double x, double y, double w, double h)
Implements java. Tests if the interior of the |
| public final boolean | intersects(Rectangle2D r)
Implements java. Tests if the interior of the |
| public abstract void | lineTo(double
the specified X coordinate x, double the specified Y coordinate y)Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates specified in double precision. |
| public abstract void | moveTo(double
the specified X coordinate x, double the specified Y coordinate y)Adds a point to the path by moving to the specified coordinates specified in double precision. |
| pack-priv abstract void | |
| pack-priv abstract int | |
| public abstract void | quadTo(double
the X coordinate of the quadratic control point x1, double the Y coordinate of the quadratic control point y1, double the X coordinate of the final end point x2, double the Y coordinate of the final end point y2)Adds a curved segment, defined by two new points, to the path by
drawing a Quadratic curve that intersects both the current
coordinates and the specified coordinates |
| pack-priv final void | |
| pack-priv abstract int | |
| public final synchronized void | |
| public final void | setWindingRule(int
an integer representing the specified
winding rule rule)Sets the winding rule for this path to the specified value. |
| public abstract void | transform(AffineTransform
the at)AffineTransform used to transform the areaTransforms the geometry of this path using the specified
|
| public abstract void | |
| pack-priv final void |