|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.geom.GeneralPath
The winding rule specifies how the interior of a path will be 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. For a NON_ZERO winding rule, we start by conceptually drawing a ray from a given point to infinity in any direction and then by examining all of the places where the path intersects the ray. We now traverse the path in one direction and keep track of the number of times that the path crosses the ray from left to right, and the number of times that the path crosses the ray from right to left. If these numbers are equal, the point is outside of the path. If they are not equal, the point is inside.
Field Summary | |
static int | WIND_EVEN_ODD
An even-odd winding rule for determining the interior of a path. |
static int | WIND_NON_ZERO
A non-zero winding rule for determining the interior of a path. |
Constructor Summary | |
GeneralPath()
Constructs a new GeneralPath object. |
|
GeneralPath(int rule,
int initialCapacity)
Constructs a new GeneralPath object with the specified winding rule and the specified initial capacity to store path coordinates. |
|
GeneralPath(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. |
|
GeneralPath(Shape s)
Constructs a new GeneralPath object from an arbitrary Shape object. |
Method Summary | |
void | append(PathIterator pi,
boolean connect)
Appends the geometry of the specified PathIterator object to the path, possibly connecting the geometry to the existing path segments with a line segment. |
void | append(Shape s,
boolean connect)
Appends the geometry of the specified Shape object to the path, possibly connecting the geometry to the existing path segments with a line segment. |
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,
double w,
double h)
Test if a given coordinate is inside the boundary of the shape. |
boolean | contains(double x,
double y)
Test if a given coordinate is inside the boundary of the shape. |
boolean | contains(Point2D p)
Test if a given Point is inside the boundary of the shape. |
boolean | contains(Rectangle2D r)
Test if a given Point is inside the boundary of the shape. |
Shape | createTransformedShape(AffineTransform at)
Returns a new transformed Path. |
void | curveTo(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
Adds 3 points to the path by drawing a Bezier curve from the current coordinates through the third set of specified coordinates, using the first and second sets of specified coordinates as Bezier control points. |
Rectangle | getBounds()
Return the bounding box of the shape. |
Rectangle2D | getBounds2D()
Returns the bounding box of the path. |
Point2D | getCurrentPoint()
Returns the most recent point added to the end of the path. |
PathIterator | getPathIterator(AffineTransform at,
double flatness)
Return an iterator object that iterates along the boundary of the flattened shape and provides access to the geometry of the outline of the shape. |
PathIterator | getPathIterator(AffineTransform at)
Return an iterator object that iterates along the boundary of the 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)
Test if the interior of the Shape intersects the interior of a given set of rectangular coordinates. |
boolean | intersects(Rectangle2D r)
Test if the interior of the Shape intersects the interior of a given Rectangle. |
void | lineTo(float x,
float y)
Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates. |
void | moveTo(float x,
float y)
Adds a point to the path by moving to the specified coordinates. |
void | quadTo(float x1,
float y1,
float x2,
float y2)
Adds 2 points to the path by drawing a Quadratic curve from the current coordinates through the second set of specified coordinates, using the first set of specified coordinates 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(AffineTransform at)
Transforms the geometry of this Path using the specified transform. |
Methods inherited from class java.lang.Object | |
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
Constructor Detail |
public GeneralPath()
WIND_NON_ZERO
public GeneralPath(int rule)
rule
- The winding rule.WIND_EVEN_ODD
,
WIND_NON_ZERO
public GeneralPath(int rule, int initialCapacity)
rule
- The winding rule.
initialCapacity
- The estimate for the number of path segments
in the path.WIND_EVEN_ODD
,
WIND_NON_ZERO
public GeneralPath(Shape s)
Method Detail |
public void moveTo(float x, float y)
public void lineTo(float x, float y)
public void quadTo(float x1, float y1, float x2, float y2)
x1
- the X coordinate of the first quadratic control point
y1
- the Y coordinate of the first quadratic control point
x2
- the X coordinate of the final endpoint
y2
- the Y coordinate of the final endpointpublic void curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
x1
- the X coordinate of the first Bezier control point
y1
- the Y coordinate of the first Bezier control point
x2
- the X coordinate of the second Bezier control point
y2
- the Y coordinate of the second Bezier control point
x3
- the X coordinate of the final endpoint
y3
- the Y coordinate of the final endpointpublic void closePath()
public void append(Shape s, boolean connect)
s
- the shape whose geometry will be appended to this path
connect
- 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(PathIterator pi, boolean connect)
s
- the shape whose geometry will be appended to this path
connect
- 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()
public void setWindingRule(int rule)
public Point2D getCurrentPoint()
public void reset()
public void transform(AffineTransform at)
at
- The matrix used to transform the area.public Shape createTransformedShape(AffineTransform at)
public Rectangle getBounds()
public Rectangle2D getBounds2D()
public boolean contains(double x, double y)
public boolean contains(Point2D p)
public boolean contains(double x, double y, double w, double h)
public boolean contains(Rectangle2D r)
public boolean intersects(double x, double y, double w, double h)
public boolean intersects(Rectangle2D r)
public PathIterator getPathIterator(AffineTransform at)
public PathIterator getPathIterator(AffineTransform at, double flatness)
public Object clone()
Cloneable
|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |