

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object java16.awt.geom.Path2D
public abstract class Path2D
The 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.Float
when dealing with data that can be represented
and used with floating point precision. Use Path2D.Double
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.
Nested Class Summary  

static class 
Path2D.Double
The Double class defines a geometric path with
coordinates stored in double precision floating point. 
static class 
Path2D.Float
The Float 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(java.awt.geom.PathIterator pi,
boolean connect)
Appends the geometry of the specified PathIterator object
to the path, possibly connecting the new geometry to the existing
path segments with a line segment. 
void 
append(java.awt.Shape s,
boolean connect)
Appends the geometry of the specified Shape object to the
path, possibly connecting the new geometry to the existing path
segments with a line segment. 
abstract java.lang.Object 
clone()
Creates a new object of the same class as this object. 
void 
closePath()
Closes the current subpath by drawing a straight line back to the coordinates of the last moveTo . 
boolean 
contains(double x,
double y)

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. 
static boolean 
contains(java.awt.geom.PathIterator pi,
double x,
double y)
Tests if the specified coordinates are inside the closed boundary of the specified PathIterator . 
static boolean 
contains(java.awt.geom.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 PathIterator . 
static boolean 
contains(java.awt.geom.PathIterator pi,
java.awt.geom.Point2D p)
Tests if the specified Point2D is inside the closed
boundary of the specified PathIterator . 
static boolean 
contains(java.awt.geom.PathIterator pi,
java.awt.geom.Rectangle2D r)
Tests if the specified Rectangle2D is entirely inside the
closed boundary of the specified PathIterator . 
boolean 
contains(java.awt.geom.Point2D p)

boolean 
contains(java.awt.geom.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. 
java.awt.Shape 
createTransformedShape(java.awt.geom.AffineTransform at)
Returns a new Shape representing a transformed version
of this Path2D . 
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 (x3,y3) ,
using the specified points (x1,y1) and (x2,y2) as
Bézier control points. 
java.awt.Rectangle 
getBounds()

java.awt.geom.Point2D 
getCurrentPoint()
Returns the coordinates most recently added to the end of the path as a Point2D object. 
java.awt.geom.PathIterator 
getPathIterator(java.awt.geom.AffineTransform at,
double flatness)
The iterator for this class is not multithreaded safe, which means that this Path2D class does not
guarantee that modifications to the geometry of this
Path2D object do not affect any iterations of
that geometry that are already in process. 
int 
getWindingRule()
Returns the fill style winding rule. 
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. 
static boolean 
intersects(java.awt.geom.PathIterator pi,
double x,
double y,
double w,
double h)
Tests if the interior of the specified PathIterator
intersects the interior of a specified set of rectangular
coordinates. 
static boolean 
intersects(java.awt.geom.PathIterator pi,
java.awt.geom.Rectangle2D r)
Tests if the interior of the specified PathIterator
intersects the interior of a specified Rectangle2D . 
boolean 
intersects(java.awt.geom.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. 
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 (x2,y2) ,
using the specified point (x1,y1) 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 
transform(java.awt.geom.AffineTransform at)
Transforms the geometry of this path using the specified AffineTransform . 
Methods inherited from class java.lang.Object 

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Methods inherited from interface java.awt.Shape 

getBounds2D, getPathIterator 
Field Detail 

public static final int WIND_EVEN_ODD
PathIterator.WIND_EVEN_ODD
,
Constant Field Valuespublic static final int WIND_NON_ZERO
PathIterator.WIND_NON_ZERO
,
Constant Field ValuesMethod Detail 

public abstract void moveTo(double x, double y)
x
 the specified X coordinatey
 the specified Y coordinatepublic abstract void lineTo(double x, double y)
x
 the specified X coordinatey
 the specified Y coordinatepublic abstract void quadTo(double x1, double y1, double x2, double y2)
(x2,y2)
,
using the specified point (x1,y1)
as a quadratic
parametric control point.
All coordinates are specified in double precision.
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 abstract void curveTo(double x1, double y1, double x2, double y2, double x3, double y3)
(x3,y3)
,
using the specified points (x1,y1)
and (x2,y2)
as
Bézier control points.
All coordinates are specified in double precision.
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 void closePath()
moveTo
. If the path is already
closed then this method has no effect.
public final void append(java.awt.Shape s, boolean connect)
Shape
object to the
path, possibly connecting the new geometry to the existing path
segments with a line segment.
If the connect
parameter is true
and the
path is not empty then any initial moveTo
in the
geometry of the appended Shape
is turned into a lineTo
segment.
If the destination coordinates of such a connecting lineTo
segment match the ending coordinates of a currently open
subpath then the segment is omitted as superfluous.
The winding rule of the specified Shape
is ignored
and the appended geometry is governed by the winding
rule specified for this path.
s
 the Shape
whose geometry is appended
to this pathconnect
 a boolean to control whether or not to turn an initial
moveTo
segment into a lineTo
segment
to connect the new geometry to the existing pathpublic abstract void append(java.awt.geom.PathIterator pi, boolean connect)
PathIterator
object
to the path, possibly connecting the new geometry to the existing
path segments with a line segment.
If the connect
parameter is true
and the
path is not empty then any initial moveTo
in the
geometry of the appended Shape
is turned into a
lineTo
segment.
If the destination coordinates of such a connecting lineTo
segment match the ending coordinates of a currently open
subpath then the segment is omitted as superfluous.
The winding rule of the specified Shape
is ignored
and the appended geometry is governed by the winding
rule specified for this path.
pi
 the PathIterator
whose geometry is appended to
this pathconnect
 a boolean to control whether or not to turn an initial
moveTo
segment into a lineTo
segment
to connect the new geometry to the existing pathpublic final int getWindingRule()
WIND_EVEN_ODD
,
WIND_NON_ZERO
,
setWindingRule(int)
public final void setWindingRule(int rule)
rule
 an integer representing the specified
winding rule
java.lang.IllegalArgumentException
 if
rule
is not either
WIND_EVEN_ODD
or
WIND_NON_ZERO
getWindingRule()
public final java.awt.geom.Point2D getCurrentPoint()
Point2D
object.
Point2D
object containing the ending coordinates of
the path or null
if there are no points in the path.public final void reset()
public abstract void transform(java.awt.geom.AffineTransform at)
AffineTransform
.
The geometry is transformed in place, which permanently changes the
boundary defined by this object.
at
 the AffineTransform
used to transform the areapublic final java.awt.Shape createTransformedShape(java.awt.geom.AffineTransform at)
Shape
representing a transformed version
of this Path2D
.
Note that the exact type and coordinate precision of the return
value is not specified for this method.
The method will return a Shape that contains no less precision
for the transformed geometry than this Path2D
currently
maintains, but it may contain no more precision either.
If the tradeoff of precision vs. storage size in the result is
important then the convenience constructors in the
Path2D.Float
and
Path2D.Double
subclasses should be used to make the choice explicit.
at
 the AffineTransform
used to transform a
new Shape
.
Shape
, transformed with the specified
AffineTransform
.public final java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
public static boolean contains(java.awt.geom.PathIterator pi, double x, double y)
PathIterator
.
This method provides a basic facility for implementors of
the Shape
interface to implement support for the
Shape.contains(double, double)
method.
pi
 the specified PathIterator
x
 the specified X coordinatey
 the specified Y coordinate
true
if the specified coordinates are inside the
specified PathIterator
; false
otherwisepublic static boolean contains(java.awt.geom.PathIterator pi, java.awt.geom.Point2D p)
Point2D
is inside the closed
boundary of the specified PathIterator
.
This method provides a basic facility for implementors of
the Shape
interface to implement support for the
Shape.contains(Point2D)
method.
pi
 the specified PathIterator
p
 the specified Point2D
true
if the specified coordinates are inside the
specified PathIterator
; false
otherwisepublic final boolean contains(double x, double y)
contains
in interface java.awt.Shape
public final boolean contains(java.awt.geom.Point2D p)
contains
in interface java.awt.Shape
public static boolean contains(java.awt.geom.PathIterator pi, double x, double y, double w, double h)
PathIterator
.
This method provides a basic facility for implementors of
the Shape
interface to implement support for the
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 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 PathIterator
x
 the specified X coordinatey
 the specified Y coordinatew
 the width of the specified rectangular areah
 the height of the specified rectangular area
true
if the specified PathIterator
contains
the specified rectangluar area; false
otherwise.public static boolean contains(java.awt.geom.PathIterator pi, java.awt.geom.Rectangle2D r)
Rectangle2D
is entirely inside the
closed boundary of the specified PathIterator
.
This method provides a basic facility for implementors of
the Shape
interface to implement support for the
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 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 PathIterator
r
 a specified Rectangle2D
true
if the specified PathIterator
contains
the specified Rectangle2D
; false
otherwise.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 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.
contains
in interface java.awt.Shape
public final boolean contains(java.awt.geom.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 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.
contains
in interface java.awt.Shape
public static boolean intersects(java.awt.geom.PathIterator pi, double x, double y, double w, double h)
PathIterator
intersects the interior of a specified set of rectangular
coordinates.
This method provides a basic facility for implementors of
the Shape
interface to implement support for the
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 PathIterator
x
 the specified X coordinatey
 the specified Y coordinatew
 the width of the specified rectangular coordinatesh
 the height of the specified rectangular coordinates
true
if the specified PathIterator
and
the interior of the specified set of rectangular
coordinates intersect each other; false
otherwise.public static boolean intersects(java.awt.geom.PathIterator pi, java.awt.geom.Rectangle2D r)
PathIterator
intersects the interior of a specified Rectangle2D
.
This method provides a basic facility for implementors of
the Shape
interface to implement support for the
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 PathIterator
r
 the specified Rectangle2D
true
if the specified PathIterator
and
the interior of the specified Rectangle2D
intersect each other; false
otherwise.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.
intersects
in interface java.awt.Shape
public final boolean intersects(java.awt.geom.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.
intersects
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
The iterator for this class is not multithreaded safe,
which means that this Path2D
class does not
guarantee that modifications to the geometry of this
Path2D
object do not affect any iterations of
that geometry that are already in process.
getPathIterator
in interface java.awt.Shape
public abstract java.lang.Object clone()
clone
in class java.lang.Object
java.lang.OutOfMemoryError
 if there is not enough memory.Cloneable


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 