Constructor
new PathStroke(type, points)
PathStroke constructor
Name | Type | Description |
---|---|---|
type | string | The type of stroke. Possible values are: |
points | Array.<module:AWT.Point> | The array of |
Members
points :Array.<module:AWT.Point>
The array of points used by this stroke. Can be null
.
- Array.<module:AWT.Point>
type :string
The Stroke type. Possible values are: M
(move to), L
(line to), Q
(quadratic to),B
(bezier to) and X
(close path).
- string
Methods
clone() → {module:AWT.PathStroke}
Clones this PathStroke
- Type:
- module:AWT.
PathStroke
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.
- The resulting object, with minimal attrributes
- Type:
- object
getEnclosingPoints(from) → {Array.<module:AWT.Point>}
Gets the set of points that will be included as a vertexs on the owner's shape
enclosing polygon.
Name | Type | Description |
---|---|---|
from | module:AWT. | The starting point for this stroke |
- Type:
- Array.<module:AWT.Point>
moveBy(delta)
Increments or decrements by delta
the x and y coordinates of all points
Name | Type | Description |
---|---|---|
delta | Point | | The amount to add to the |
multBy(delta)
Multiplies each point coordinates by the x
and y
(or w
and h
) values of the
passed module:AWT.Point
or Dimension
.
Name | Type | Description |
---|---|---|
delta | Point | |
stroke(ctx)
Draws this PathStroke in the provided HTML canvas context
Name | Type | Description |
---|---|---|
ctx | external:CanvasRenderingContext2D | The HTML canvas 2D rendering context |
(static) getCubicPoints(p0, p1, p2, p3, numPointsopt) → {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
Name | Type | Attributes | Description |
---|---|---|---|
p0 | module:AWT. | Starting point of the cubic Bézier curve | |
p1 | module:AWT. | First control point | |
p2 | module:AWT. | Second control point | |
p3 | module:AWT. | Ending point | |
numPoints | number | <optional> | The number of intermediate points to calculate. When not defined, |
- Array with some intermediate points from the resulting Bézier curve
- Type:
- Array.<module:AWT.Point>
(static) getQuadraticPoints(p0, p1, p2, numPointsopt) → {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
Name | Type | Attributes | Description |
---|---|---|---|
p0 | module:AWT. | Starting point of the quadratic Bézier curve | |
p1 | module:AWT. | Control point | |
p2 | module:AWT. | Ending point | |
numPoints | number | <optional> | The number of intermediate points to calculate. When not defined, |
- Array with some intermediate points from the resulting Bézier curve
- Type:
- Array.<module:AWT.Point>