public class InsetPathWriter extends PathWriter
If you trace two new paths (one on either side of the original path) and then join those two new paths together: you've just created an outline/stroke of your original path.
To compare this with the BasicStroke class: this class uses a JOIN_BEVEL and does not address caps (however if you just draw a line from one inset path to another: that is a CAP_BUTT.)
| Constructor and Description |
|---|
InsetPathWriter(PathWriter
This creates a new InsetPathWriter.
|
InsetPathWriter(PathWriter
This creates a new InsetPathWriter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closePath()
Closes the current subpath by drawing a straight line back to the coordinates of the last moveTo.
|
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.
|
void |
flush()
This guarantees that this writer has flushed all currently written information.
|
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 ctrlX, float ctrlY, 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.
|
public InsetPathWriter(PathWriterw, float inset, boolean clockwise)
w - the destination to write the new path data to.
inset - the number of pixels to inset
clockwise - where to draw the inset path. If this is true, then the path is drawn at 90 degrees clockwise to the original path. Otherwise this is drawn at 90 degrees counterclockwise.
public InsetPathWriter(PathWriterw, float inset, float theta)
w - the destination to write the new path data to.
inset - the number of pixels to inset
theta - the angle the path will be written at. That is: if you draw a line tangent to the original path, and then move
(+inset*cos(theta), +inset*sin(theta)), that is where this path will be written.
public void closePath()
PathWriter
public void curveTo(float cx1,
float cy1,
float cx2,
float cy2,
float x,
float y)
PathWriter
curveTo in class
PathWriter
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 void lineTo(float x,
float y)
PathWriter
lineTo in class
PathWriter
x - the x-coordinate of the end point.
y - the y-coordinate of the end point.
public void moveTo(float x,
float y)
PathWriter
moveTo in class
PathWriter
x - the x-coordinate to move to
y - the y-coordinate to move to
public void flush()
PathWriter
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 quadTo(float ctrlX,
float ctrlY,
float x,
float y)
PathWriter
quadTo in class
PathWriter
ctrlX - the x-coordinate of the control point.
ctrlY - the y-coordinate of the control point.
x - the x-coordinate of the end point.
y - the y-coordinate of the end point.