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>, ): PathStroke

PathStroke constructor

Parameters

  • type (string) — The type of stroke. 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 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

  • delta (Point | Dimension) — The amount to add to the x and y
    coordinates of each point.

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

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

Returns

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 curve
  • p1 (module:AWT.Point) — Control point
  • p2 (module:AWT.Point) — Ending point
  • numPoints (number, optional) — The number of intermediate points to calculate. When not defined,
    the value will be obtained from module:Utils.settings.BEZIER_POINTS.

Returns

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 curve
  • p1 (module:AWT.Point) — First control point
  • p2 (module:AWT.Point) — Second control point
  • p3 (module:AWT.Point) — Ending point
  • numPoints (number, optional) — The number of intermediate points to calculate. When not defined,
    the value will be obtained from module:Utils.settings.BEZIER_POINTS.

Returns

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.