public interface PathVisitor
PathIterator
and draws the
shape as it is visited. The form of this interface and the documentation
closely mirror that class.
Note: The implementation should assume that the array being passed into each of these calls is being modified when the call returns, the vertex array is recycled and any storage of the points should guard against external mutation.
PathIterator
Modifier and Type | Method and Description |
---|---|
void |
beginPoly(int windingRule)
Starts the polygon or polyline.
|
void |
closeLine()
Specifies that the preceding subpath should be closed by appending a line
segment back to the point corresponding to the most recent call to
#moveTo(float[]) . |
void |
cubicTo(float[] previousVertex,
float[] control)
Specifies a cubic parametric curve to be drawn.
|
void |
endPoly()
Signifies that the polygon or polyline has ended.
|
void |
lineTo(float[] vertex)
Specifies the end point of a line to be drawn from the most recently
specified point.
|
void |
moveTo(float[] vertex)
Specifies the starting location for a new subpath.
|
void |
quadTo(float[] previousVertex,
float[] control)
Specifies a quadratic parametric curve is to be drawn.
|
void |
setGLContext(GL context)
Sets the GL context to be used for the next drawing session.
|
void |
setStroke(BasicStroke stroke)
Sets the stroke to be used when drawing a path.
|
void setGLContext(GL context)
context
- The GL contextvoid setStroke(BasicStroke stroke)
void moveTo(float[] vertex)
vertex
- An array where the first two values are the x,y coordinates of the
start of the subpath.void lineTo(float[] vertex)
vertex
- An array where the first two values are the x,y coordinates of the
next point in the subpath.void quadTo(float[] previousVertex, float[] control)
(t=[0..1])
using the previous point (CP), the first control
point (P1), and the final interpolated control point (P2). The parametric
control equation for this curve is:
P(t) = B(2,0)*CP + B(2,1)*P1 + B(2,2)*P2 0 <= t <= 1 B(n,m) = mth coefficient of nth degree Bernstein polynomial = C(n,m) * t^(m) * (1 - t)^(n-m) C(n,m) = Combinations of n things, taken m at a time = n! / (m! * (n-m)!)
previousVertex
- The first control point. The same as the most recent specified
vertex.control
- The control point and the second vertex, in order.void cubicTo(float[] previousVertex, float[] control)
(t=[0..1])
using the previous point (CP), the first control
point (P1), the second control point (P2), and the final interpolated
control point (P3). The parametric control equation for this curve is:
P(t) = B(3,0)*CP + B(3,1)*P1 + B(3,2)*P2 + B(3,3)*P3 0 <= t <= 1 B(n,m) = mth coefficient of nth degree Bernstein polynomial = C(n,m) * t^(m) * (1 - t)^(n-m) C(n,m) = Combinations of n things, taken m at a time = n! / (m! * (n-m)!)This form of curve is commonly known as a Bézier curve.
previousVertex
- The first control point. The same as the most recent specified
vertex.control
- The two control points and the second vertex, in order.void closeLine()
#moveTo(float[])
.void beginPoly(int windingRule)
windingRule
- The winding rule for the polygon.void endPoly()
Copyright © 2010-2013. All Rights Reserved.