 
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
public abstract class Path2D extends Object implements Shape, Cloneable
The {@code 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 {@link PathIterator} interface including all of its segment types and winding rules and it implements all of the basic hit testing methods of the {@link Shape} interface.
Use {@link Path2D.Float} when dealing with data that can be represented and used with floating point precision. Use {@link Path2D.Double} for data that requires the accuracy or range of double precision.
{@code 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 {@link Area} class provides additional capabilities specifically targeted at closed figures. While both classes nominally implement the {@code Shape} interface, they differ in purpose and together they provide two useful views of a geometric shape where {@code Path2D} deals primarily with a trajectory formed by path segments and {@code Area} deals more with interpretation and manipulation of enclosed regions of 2D geometric space.
The {@link 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.
Nested Class Summary  

static class 
The class defines a geometric path with coordinates stored in double precision floating point. 
static class 
The class defines a geometric path with coordinates stored in single precision floating point. 
Field Summary  

static int 
WIND_EVEN_ODD
An evenodd winding rule for determining the interior of a path. 
static int 
WIND_NON_ZERO
A nonzero winding rule for determining the interior of a path. 
Method Summary  

abstract void 
append(PathIterator pi, boolean connect) Appends the geometry of the specified java.awt.geom.PathIterator object to the path, possibly connecting the new geometry to the existing path segments with a line segment. 
void 
Appends the geometry of the specified object to the path, possibly connecting the new geometry to the existing path segments with a line segment. 
abstract Object 
clone() Creates a new object of the same class as this object. 
void 
Closes the current subpath by drawing a straight line back to the coordinates of the last . 
boolean 
contains(double x, double y) 
boolean 
contains(double x, double y, double w, double h) 
static boolean 
contains(PathIterator pi, double x, double y) Tests if the specified coordinates are inside the closed boundary of the specified java.awt.geom.PathIterator. 
static boolean 
contains(PathIterator pi, double x, double y, double w, double h) Tests if the specified rectangular area is entirely inside the closed boundary of the specified java.awt.geom.PathIterator. 
static boolean 
contains(PathIterator pi, Point2D p) Tests if the specified java.awt.geom.Point2D is inside the closed boundary of the specified java.awt.geom.PathIterator. 
static boolean 
contains(PathIterator pi, Rectangle2D r) Tests if the specified java.awt.geom.Rectangle2D is entirely inside the closed boundary of the specified java.awt.geom.PathIterator. 
boolean 

boolean 

Shape 
Returns a new representing a transformed version of this . 
abstract void 
curveTo(double x1, double y1, double x2, double y2, double x3, double 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 , using the specified points and as Bézier control points. 
Rectangle 

Point2D 
Returns the coordinates most recently added to the end of the path as a java.awt.geom.Point2D object. 
PathIterator 
getPathIterator(AffineTransform at, double flatness) 
int 
Returns the fill style winding rule. 
boolean 
intersects(double x, double y, double w, double h) 
static boolean 
intersects(PathIterator pi, double x, double y, double w, double h) Tests if the interior of the specified java.awt.geom.PathIterator intersects the interior of a specified set of rectangular coordinates. 
static boolean 
intersects(PathIterator pi, Rectangle2D r) Tests if the interior of the specified java.awt.geom.PathIterator intersects the interior of a specified java.awt.geom.Rectangle2D. 
boolean 

abstract void 
lineTo(double x, double 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. 
abstract void 
moveTo(double x, double y) Adds a point to the path by moving to the specified coordinates specified in double precision. 
abstract void 
quadTo(double x1, double y1, double x2, double 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 , using the specified point as a quadratic parametric control point. 
void 
reset() Resets the path to empty. 
void 
setWindingRule(int rule) Sets the winding rule for this path to the specified value. 
abstract void 
Transforms the geometry of this path using the specified java.awt.geom.AffineTransform. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

public static final int WIND_EVEN_ODD
public static final int WIND_NON_ZERO
Method Detail 

public abstract void append(PathIterator pi, boolean connect)
pi
 the {@code PathIterator} whose geometry is appended to
this pathconnect
 a boolean to control whether or not to turn an initial
{@code moveTo} segment into a {@code lineTo} segment
to connect the new geometry to the existing pathpublic final void append(Shape s, boolean connect)
s
 the {@code Shape} whose geometry is appended
to this pathconnect
 a boolean to control whether or not to turn an initial
{@code moveTo} segment into a {@code lineTo} segment
to connect the new geometry to the existing pathpublic abstract Object clone()
clone
in class Object
public final synchronized void closePath()
public final boolean contains(double x, double y)
x
y
public final boolean contains(double x, double y, double w, double h)
This method object may conservatively return false in cases where the specified rectangular area intersects a segment of the path, but that segment does not represent a boundary between the interior and exterior of the path. Such segments could lie entirely within the interior of the path if they are part of a path with a {@link #WIND_NON_ZERO} winding rule or if the segments are retraced in the reverse direction such that the two sets of segments cancel each other out without any exterior area falling between them. To determine whether segments represent true boundaries of the interior of the path would require extensive calculations involving all of the segments of the path and the winding rule and are thus beyond the scope of this implementation.
x
y
w
h
public static boolean contains(PathIterator pi, double x, double y)
This method provides a basic facility for implementors of the {@link Shape} interface to implement support for the {@link Shape#contains(double, double)} method.
pi
 the specified {@code PathIterator}x
 the specified X coordinatey
 the specified Y coordinatepublic static boolean contains(PathIterator pi, double x, double y, double w, double h)
This method provides a basic facility for implementors of the {@link Shape} interface to implement support for the {@link Shape#contains(double, double, double, double)} method.
This method object may conservatively return false in cases where the specified rectangular area intersects a segment of the path, but that segment does not represent a boundary between the interior and exterior of the path. Such segments could lie entirely within the interior of the path if they are part of a path with a {@link #WIND_NON_ZERO} winding rule or if the segments are retraced in the reverse direction such that the two sets of segments cancel each other out without any exterior area falling between them. To determine whether segments represent true boundaries of the interior of the path would require extensive calculations involving all of the segments of the path and the winding rule and are thus beyond the scope of this implementation.
pi
 the specified {@code PathIterator}x
 the specified X coordinatey
 the specified Y coordinatew
 the width of the specified rectangular areah
 the height of the specified rectangular areapublic static boolean contains(PathIterator pi, Point2D p)
This method provides a basic facility for implementors of the {@link Shape} interface to implement support for the {@link Shape#contains(Point2D)} method.
pi
 the specified {@code PathIterator}p
 the specified {@code Point2D}public static boolean contains(PathIterator pi, Rectangle2D r)
This method provides a basic facility for implementors of the {@link Shape} interface to implement support for the {@link Shape#contains(Rectangle2D)} method.
This method object may conservatively return false in cases where the specified rectangular area intersects a segment of the path, but that segment does not represent a boundary between the interior and exterior of the path. Such segments could lie entirely within the interior of the path if they are part of a path with a {@link #WIND_NON_ZERO} winding rule or if the segments are retraced in the reverse direction such that the two sets of segments cancel each other out without any exterior area falling between them. To determine whether segments represent true boundaries of the interior of the path would require extensive calculations involving all of the segments of the path and the winding rule and are thus beyond the scope of this implementation.
pi
 the specified {@code PathIterator}r
 a specified {@code Rectangle2D}public final boolean contains(Point2D p)
p
public final boolean contains(Rectangle2D r)
This method object may conservatively return false in cases where the specified rectangular area intersects a segment of the path, but that segment does not represent a boundary between the interior and exterior of the path. Such segments could lie entirely within the interior of the path if they are part of a path with a {@link #WIND_NON_ZERO} winding rule or if the segments are retraced in the reverse direction such that the two sets of segments cancel each other out without any exterior area falling between them. To determine whether segments represent true boundaries of the interior of the path would require extensive calculations involving all of the segments of the path and the winding rule and are thus beyond the scope of this implementation.
r
public final synchronized Shape createTransformedShape(AffineTransform at)
at
 the {@code AffineTransform} used to transform a
new {@code Shape}.public abstract void curveTo(double x1, double y1, double x2, double y2, double x3, double y3)
x1
 the X coordinate of the first Bézier control pointy1
 the Y coordinate of the first Bézier control pointx2
 the X coordinate of the second Bézier control pointy2
 the Y coordinate of the second Bézier control pointx3
 the X coordinate of the final end pointy3
 the Y coordinate of the final end pointpublic final Rectangle getBounds()
public final synchronized Point2D getCurrentPoint()
public PathIterator getPathIterator(AffineTransform at, double flatness)
The iterator for this class is not multithreaded safe, which means that this {@code Path2D} class does not guarantee that modifications to the geometry of this {@code Path2D} object do not affect any iterations of that geometry that are already in process.
at
flatness
public final synchronized int getWindingRule()
public final boolean intersects(double x, double y, double w, double h)
This method object may conservatively return true in cases where the specified rectangular area intersects a segment of the path, but that segment does not represent a boundary between the interior and exterior of the path. Such a case may occur if some set of segments of the path are retraced in the reverse direction such that the two sets of segments cancel each other out without any interior area between them. To determine whether segments represent true boundaries of the interior of the path would require extensive calculations involving all of the segments of the path and the winding rule and are thus beyond the scope of this implementation.
x
y
w
h
public static boolean intersects(PathIterator pi, double x, double y, double w, double h)
This method provides a basic facility for implementors of the {@link Shape} interface to implement support for the {@link Shape#intersects(double, double, double, double)} method.
This method object may conservatively return true in cases where the specified rectangular area intersects a segment of the path, but that segment does not represent a boundary between the interior and exterior of the path. Such a case may occur if some set of segments of the path are retraced in the reverse direction such that the two sets of segments cancel each other out without any interior area between them. To determine whether segments represent true boundaries of the interior of the path would require extensive calculations involving all of the segments of the path and the winding rule and are thus beyond the scope of this implementation.
pi
 the specified {@code PathIterator}x
 the specified X coordinatey
 the specified Y coordinatew
 the width of the specified rectangular coordinatesh
 the height of the specified rectangular coordinatespublic static boolean intersects(PathIterator pi, Rectangle2D r)
This method provides a basic facility for implementors of the {@link Shape} interface to implement support for the {@link Shape#intersects(Rectangle2D)} method.
This method object may conservatively return true in cases where the specified rectangular area intersects a segment of the path, but that segment does not represent a boundary between the interior and exterior of the path. Such a case may occur if some set of segments of the path are retraced in the reverse direction such that the two sets of segments cancel each other out without any interior area between them. To determine whether segments represent true boundaries of the interior of the path would require extensive calculations involving all of the segments of the path and the winding rule and are thus beyond the scope of this implementation.
pi
 the specified {@code PathIterator}r
 the specified {@code Rectangle2D}public final boolean intersects(Rectangle2D r)
This method object may conservatively return true in cases where the specified rectangular area intersects a segment of the path, but that segment does not represent a boundary between the interior and exterior of the path. Such a case may occur if some set of segments of the path are retraced in the reverse direction such that the two sets of segments cancel each other out without any interior area between them. To determine whether segments represent true boundaries of the interior of the path would require extensive calculations involving all of the segments of the path and the winding rule and are thus beyond the scope of this implementation.
r
public abstract void lineTo(double x, double y)
x
 the specified X coordinatey
 the specified Y coordinatepublic abstract void moveTo(double x, double y)
x
 the specified X coordinatey
 the specified Y coordinatepublic abstract void quadTo(double x1, double y1, double x2, double y2)
x1
 the X coordinate of the quadratic control pointy1
 the Y coordinate of the quadratic control pointx2
 the X coordinate of the final end pointy2
 the Y coordinate of the final end pointpublic final synchronized void reset()
public final void setWindingRule(int rule)
rule
 an integer representing the specified
winding rulepublic abstract void transform(AffineTransform at)
at
 the {@code AffineTransform} used to transform the area
 
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 