

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object math.geom2d.curve.GeneralPath2D
public final class GeneralPath2D
The GeneralPath
class represents a geometric path constructed
from straight lines, and quadratic and cubic (Bezier) curves. It can contain
multiple subpaths.
The winding rule specifies how the interior of a path is determined. There are two types of winding rules: EVEN_ODD and NON_ZERO.
An EVEN_ODD winding rule means that enclosed regions of the path alternate between interior and exterior areas as traversed from the outside of the path towards a point inside the region.
A NON_ZERO winding rule means that if a ray is drawn in any direction from a given point to infinity and the places where the path intersects the ray are examined, the point is inside of the path if and only if the number of times that the path crosses the ray from left to right does not equal the number of times that the path crosses the ray from right to left.
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. 
Constructor Summary  

GeneralPath2D()
Constructs a new GeneralPath object. 

GeneralPath2D(int rule)
Constructs a new GeneralPath object with the specified
winding rule to control operations that require the interior of the path
to be defined. 

GeneralPath2D(int rule,
int initialCapacity)
Constructs a new GeneralPath object with the specified
winding rule and the specified initial capacity to store path
coordinates. 

GeneralPath2D(java.awt.Shape s)
Constructs a new GeneralPath object from an arbitrary
Shape object. 
Method Summary  

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. 
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)
Tests if the specified coordinates are inside the boundary of this Shape . 
boolean 
contains(double x,
double y,
double w,
double h)
Tests if the specified rectangular area is inside the boundary of this Shape . 
boolean 
contains(java.awt.geom.Point2D p)
Tests if the specified Point2D is inside the boundary of
this Shape . 
boolean 
contains(Point2D p)
Tests if the specified Point2D is inside the boundary of
this Shape . 
boolean 
contains(java.awt.geom.Rectangle2D r)
Tests if the specified Rectangle2D is inside the boundary
of this Shape . 
java.awt.Shape 
createTransformedShape(java.awt.geom.AffineTransform at)
Returns a new transformed Shape . 
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 Bezier curve that intersects both the current coordinates and the coordinates (x3, y3), using the specified points (x1, y1) and (x2, y2) as Bezier control points. 
void 
curveTo(Point2D p1,
Point2D p2,
Point2D p3)
Adds a curved segment, defined by three new points, to the path by drawing a Bezier curve that intersects both the current coordinates and the coordinates (x3, y3), using the specified points (x1, y1) and (x2, y2) as Bezier control points. 
boolean 
equals(java.lang.Object obj)

java.awt.Rectangle 
getBounds()
Return the bounding box of the path. 
java.awt.geom.Rectangle2D 
getBounds2D()
Returns the bounding box of the path. 
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)
Returns a PathIterator object that iterates along the
boundary of this Shape and provides access to the geometry
of the outline of this Shape . 
java.awt.geom.PathIterator 
getPathIterator(java.awt.geom.AffineTransform at,
double flatness)
Returns a PathIterator object that iterates along the
boundary of the flattened Shape and provides access to the
geometry of the outline of the Shape . 
int 
getWindingRule()
Returns the fill style winding rule. 
boolean 
intersects(double x,
double y,
double w,
double h)
Tests if the interior of this Shape intersects the
interior of a specified set of rectangular coordinates. 
boolean 
intersects(java.awt.geom.Rectangle2D r)
Tests if the interior of this Shape intersects the
interior of a specified Rectangle2D . 
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. 
void 
lineTo(Point2D p)
Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates. 
void 
moveTo(double x,
double y)
Adds a point to the path by moving to the specified coordinates. 
void 
moveTo(Point2D p)
Adds a point to the path by moving to the specified coordinates. 
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 coordinates (x2, y2), using the specified point (x1, y1) as a quadratic parametric control point. 
void 
quadTo(Point2D p1,
Point2D p2)
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 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. 
void 
transform(java.awt.geom.AffineTransform at)
Transforms the geometry of this path using the specified AffineTransform . 
Methods inherited from class java.lang.Object 

getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

public static final int WIND_EVEN_ODD
public static final int WIND_NON_ZERO
Constructor Detail 

public GeneralPath2D()
GeneralPath
object. If an operation
performed on this path requires the interior of the path to be defined
then the default NON_ZERO winding rule is used.
WIND_NON_ZERO
public GeneralPath2D(int rule)
GeneralPath
object with the specified
winding rule to control operations that require the interior of the path
to be defined.
rule
 the winding ruleWIND_EVEN_ODD
,
WIND_NON_ZERO
public GeneralPath2D(int rule, int initialCapacity)
GeneralPath
object with the specified
winding rule and the specified initial capacity to store path
coordinates. This number is an initial guess as to how many path segments
are in the path, but the storage is expanded as needed to store whatever
path segments are added to this path.
rule
 the winding ruleinitialCapacity
 the estimate for the number of path segments in
the pathWIND_EVEN_ODD
,
WIND_NON_ZERO
public GeneralPath2D(java.awt.Shape s)
GeneralPath
object from an arbitrary
Shape
object. All of the initial geometry and the winding rule
for this path are taken from the specified Shape
object.
s
 the specified Shape
objectMethod Detail 

public void moveTo(double x, double y)
x
 the xcoordinate of the destinationy
 the ycoordinate of the destinationpublic void moveTo(Point2D p)
p
 the specified pointpublic void lineTo(double x, double y)
x
 the xcoordinate of the destinationy
 the ycoordinate of the destinationpublic void lineTo(Point2D p)
p
 the coordinate of the destionation pointpublic void quadTo(double x1, double y1, double x2, double y2)
x1
 the xcoordinate of the control pointy1
 the ycoordinate of the control pointx2
 the xcoordinate of the end pointy2
 the ycoordinate of the end pointpublic void quadTo(Point2D p1, Point2D p2)
p1
 the control pointp2
 the end pointpublic void curveTo(double x1, double y1, double x2, double y2, double x3, double y3)
x1
 the xcoordinate of the first control pointy1
 the ycoordinate of the first control pointx2
 the xcoordinate of the second control pointy2
 the ycoordinate of the second control pointx3
 the xcoordinate of the end pointy3
 the ycoordinate of the end pointpublic void curveTo(Point2D p1, Point2D p2, Point2D p3)
p1
 the coordinates of the first control pointp2
 the coordinates of the second control pointp3
 the coordinates of the final endpointpublic void closePath()
moveTo
. If the path is already
closed then this method has no effect.
public 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 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 int getWindingRule()
WIND_EVEN_ODD
,
WIND_NON_ZERO
public void setWindingRule(int rule)
rule
 an integer representing the specified winding rule
IllegalArgumentException
 if rule
is not either WIND_EVEN_ODD
or
WIND_NON_ZERO
WIND_EVEN_ODD
,
WIND_NON_ZERO
public Point2D getCurrentPoint()
Point2D
object.
Point2D
object containing the ending coordinates
of the path or null
if there are no points in the
path.public void reset()
public 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 java.awt.Shape createTransformedShape(java.awt.geom.AffineTransform at)
Shape
.
at
 the AffineTransform
used to transform a new
Shape
.
Shape
, transformed with the specified
AffineTransform
.public java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
Rectangle
object that bounds the current path.public java.awt.geom.Rectangle2D getBounds2D()
getBounds2D
in interface java.awt.Shape
Rectangle2D
object that bounds the current path.public boolean contains(double x, double y)
Shape
.
contains
in interface java.awt.Shape
x
 the xcoordinate of the pointy
 the ycoordinate of the point
true
if the specified coordinates are inside this
Shape
; false
otherwisepublic boolean contains(java.awt.geom.Point2D p)
Point2D
is inside the boundary of
this Shape
.
contains
in interface java.awt.Shape
p
 the specified Point2D
true
if this Shape
contains the
specified Point2D
, false
otherwise.public boolean contains(Point2D p)
Point2D
is inside the boundary of
this Shape
.
p
 the specified Point2D
true
if this Shape
contains the
specified Point2D
, false
otherwise.public boolean contains(double x, double y, double w, double h)
Shape
.
contains
in interface java.awt.Shape
x
 the x coordinate of the rectangley
 the y coordinate of the rectanglew
 the width of the specified rectangular areah
 the height of the specified rectangular area
true
if this Shape
contains the
specified rectangluar area; false
otherwise.public boolean contains(java.awt.geom.Rectangle2D r)
Rectangle2D
is inside the boundary
of this Shape
.
contains
in interface java.awt.Shape
r
 a specified Rectangle2D
true
if this Shape
bounds the
specified Rectangle2D
; false
otherwise.public boolean intersects(double x, double y, double w, double h)
Shape
intersects the
interior of a specified set of rectangular coordinates.
intersects
in interface java.awt.Shape
x
 the position of the left cornery
 the position of the bottom cornerw
 the width of the specified rectangular coordinatesh
 the height of the specified rectangular coordinates
true
if this Shape
and the interior
of the specified set of rectangular coordinates intersect each
other; false
otherwise.public boolean intersects(java.awt.geom.Rectangle2D r)
Shape
intersects the
interior of a specified Rectangle2D
.
intersects
in interface java.awt.Shape
r
 the specified Rectangle2D
true
if this Shape
and the interior
of the specified Rectangle2D
intersect each other;
false
otherwise.public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
PathIterator
object that iterates along the
boundary of this Shape
and provides access to the geometry
of the outline of this Shape
. The iterator for this class
is not multithreaded safe, which means that this
GeneralPath
class does not guarantee that modifications to
the geometry of this GeneralPath
object do not affect any
iterations of that geometry that are already in process.
getPathIterator
in interface java.awt.Shape
at
 an AffineTransform
PathIterator
that iterates along the
boundary of this Shape
and provides access to the
geometry of this Shape
's outlinepublic java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
PathIterator
object that iterates along the
boundary of the flattened Shape
and provides access to the
geometry of the outline of the Shape
. The iterator for
this class is not multithreaded safe, which means that this
GeneralPath
class does not guarantee that modifications to
the geometry of this GeneralPath
object do not affect any
iterations of that geometry that are already in process.
getPathIterator
in interface java.awt.Shape
at
 an AffineTransform
flatness
 the maximum distance that the line segments used to
approximate the curved segments are allowed to deviate from
any point on the original curve
PathIterator
that iterates along the
flattened Shape
boundary.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public 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 