PathStroke
Source: AWT.js:1586
PathStroke is the basic component of module:AWT.Path objects
Constructor
new PathStroke(
type: string,
points: Array.<module:AWT.Point>,
): PathStrokePathStroke constructor
Parameters
type(string) — The type of stroke. Possible values are:M(move to),L(line to),
Q(quadratic to),B(bezier to) andX(close path).points(Array.<module:AWT.Point>) — The array of module:AWT.Point objects used in this Stroke.
Instance Methods
clone(): module:AWT.PathStroke
Clones this PathStroke
Returns
moveBy(delta: Point | Dimension)
Increments or decrements by delta the x and y coordinates of all points
Parameters
multBy(delta: Point | Dimension)
Multiplies each point coordinates by the x and y (or w and h) values of the
passed module:AWT.Point or Dimension.
Parameters
stroke(ctx: external:CanvasRenderingContext2D)
Draws this PathStroke in the provided HTML canvas context
Parameters
ctx(external:CanvasRenderingContext2D) — The HTML canvas 2D rendering context
getEnclosingPoints(
from: module:AWT.Point,
): Array.<module:AWT.Point>
Gets the set of points that will be included as a vertexs on the owner's shape
enclosing polygon.
Parameters
from(module:AWT.Point) — The starting point for this stroke
Returns
Array.<module:AWT.Point>
getAttributes(): object
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
Returns
object
Static Methods
getQuadraticPoints(
p0: module:AWT.Point,
p1: module:AWT.Point,
p2: module:AWT.Point,
numPoints?: number,
): Array.<module:AWT.Point>
Calculates some of the points included in a quadratic Bézier curve
The number of points being calculated is defined in Utils.settings.BEZIER_POINTS
Parameters
p0(module:AWT.Point) — Starting point of the quadratic Bézier curvep1(module:AWT.Point) — Control pointp2(module:AWT.Point) — Ending pointnumPoints(number, optional) — The number of intermediate points to calculate. When not defined,
the value will be obtained frommodule:Utils.settings.BEZIER_POINTS.
Returns
Array.<module:AWT.Point>
getCubicPoints(
p0: module:AWT.Point,
p1: module:AWT.Point,
p2: module:AWT.Point,
p3: module:AWT.Point,
numPoints?: number,
): Array.<module:AWT.Point>
Calculates some of the points included in a cubic Bézier (curve with two control points)
The number of points being calculated is defined in Utils.settings.BEZIER_POINTS
Parameters
p0(module:AWT.Point) — Starting point of the cubic Bézier curvep1(module:AWT.Point) — First control pointp2(module:AWT.Point) — Second control pointp3(module:AWT.Point) — Ending pointnumPoints(number, optional) — The number of intermediate points to calculate. When not defined,
the value will be obtained frommodule:Utils.settings.BEZIER_POINTS.
Returns
Array.<module:AWT.Point>
Instance Fields
type: string
The Stroke type. Possible values are: M (move to), L (line to), Q (quadratic to),
B (bezier to) and X (close path).
points: Array.<module:AWT.Point>
The array of points used by this stroke. Can be null.