public abstract class PathWriter extends Object
With this abstract class you could filter shape data as it is being written. The simplest extension of this is the GeneralPathWriter.
This is designed to match the GeneralPath method signatures.
| Constructor and Description |
|---|
PathWriter()
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
closePath()
Closes the current subpath by drawing a straight line back to the coordinates of the last moveTo.
|
static void |
cubicTo(GeneralPath
This appends a cubic curve to the GeneralPath provided that ranges from t = t0 to t = t1.
|
static void |
cubicTo(PathWriter
This appends a cubic curve to the PathWriter provided that ranges from t = t0 to t = t1.
|
abstract void |
curveTo(float cx1, float cy1, float cx2, float cy2, float x, float y)
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.
|
abstract void |
flush()
This guarantees that this writer has flushed all currently written information.
|
abstract 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.
|
abstract void |
moveTo(float x, float y)
Adds a point to the path by moving to the specified coordinates.
|
abstract void |
quadTo(float cx, float cy, float x, float y)
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.
|
static void |
quadTo(GeneralPath
This appends a quadratic curve to the GeneralPath provided that ranges from t = t0 to t = t1.
|
static void |
quadTo(PathWriter
This appends a quadratic curve to the PathWriter provided that ranges from t = t0 to t = t1.
|
void |
write(PathIterator
Writes a path.
|
void |
write(Shape
Writes a shape.
|
public abstract void moveTo(float x,
float y)
x - the x-coordinate to move to
y - the y-coordinate to move to
public abstract void lineTo(float x,
float y)
x - the x-coordinate of the end point.
y - the y-coordinate of the end point.
public abstract void quadTo(float cx,
float cy,
float x,
float y)
cx - the x-coordinate of the control point.
cy - the y-coordinate of the control point.
x - the x-coordinate of the end point.
y - the y-coordinate of the end point.
public abstract void curveTo(float cx1,
float cy1,
float cx2,
float cy2,
float x,
float y)
cx1 - the x-coordinate of the first control point.
cy1 - the y-coordinate of the first control point.
cx2 - the x-coordinate of the second control point.
cy2 - the y-coordinate of the second control point.
x - the x-coordinate of the end point.
y - the y-coordinate of the end point.
public abstract void closePath()
public abstract void flush()
For example, some writers may need to perform complex calculations and re-organize shapes. Or some writers may simply be buffering path instructions to better manage memory. Calling this method guarantees that all path instructions be immediately processed.
Because some writers may be manipulating path data you should not call this method until all shape data has been written.
public void write(Shapes)
This iterates through the shape and makes the appropriate calls to moveTo(), curveTo(), etc.
s - the shape to write.
public void write(PathIteratori)
This iterates through the path and makes the appropriate calls to moveTo(), curveTo(), etc.
i - the path to write.
public static void cubicTo(GeneralPathpath, double t0, double t1, double ax, double bx, double cx, double dx, double ay, double by, double cy, double dy)
path - the path to append data to.
t0 - the t-value for the beginning of this curve
t1 - the t-value for the end of this curve
ax - the coefficient for the (t^3) term of the x parametric equation
bx - the coefficient for the (t^2) term of the x parametric equation
cx - the coefficient for the t term of the x parametric equation
dx - the constant for the x parametric equation.
ay - the coefficient for the (t^3) term of the y parametric equation
by - the coefficient for the (t^2) term of the y parametric equation
cy - the coefficient for the t term of the y parametric equation
dy - the constant for the y parametric equation.
public static void cubicTo(PathWriterpath, double t0, double t1, double ax, double bx, double cx, double dx, double ay, double by, double cy, double dy)
path - the path to append data to.
t0 - the t-value for the beginning of this curve
t1 - the t-value for the end of this curve
ax - the coefficient for the (t^3) term of the x parametric equation
bx - the coefficient for the (t^2) term of the x parametric equation
cx - the coefficient for the t term of the x parametric equation
dx - the constant for the x parametric equation.
ay - the coefficient for the (t^3) term of the y parametric equation
by - the coefficient for the (t^2) term of the y parametric equation
cy - the coefficient for the t term of the y parametric equation
dy - the constant for the y parametric equation.
public static void quadTo(GeneralPathpath, double t0, double t1, double ax, double bx, double cx, double ay, double by, double cy)
path - the path to append data to.
t0 - the t-value for the beginning of this curve
t1 - the t-value for the end of this curve
ax - the coefficient for the (t^2) term of the x parametric equation
bx - the coefficient for the t term of the x parametric equation
cx - the constant for the x parametric equation.
ay - the coefficient for the (t^2) term of the y parametric equation
by - the coefficient for the t term of the y parametric equation
cy - the constant for the y parametric equation.
public static void quadTo(PathWriterpath, double t0, double t1, double ax, double bx, double cx, double ay, double by, double cy)
path - the path to append data to.
t0 - the t-value for the beginning of this curve
t1 - the t-value for the end of this curve
ax - the coefficient for the (t^2) term of the x parametric equation
bx - the coefficient for the t term of the x parametric equation
cx - the constant for the x parametric equation.
ay - the coefficient for the (t^2) term of the y parametric equation
by - the coefficient for the t term of the y parametric equation
cy - the constant for the y parametric equation.