AWT. Stroke

Contains properties used to draw lines in HTML canvas elements.

Constructor

new Stroke(lineWidthopt, lineCapopt, lineJoinopt, miterLimitopt)

Stroke constructor

Parameters:
NameTypeAttributesDefaultDescription
lineWidthnumber<optional>
1

The line width of the stroke

lineCapstring<optional>
'butt'

The line ending type. Possible values are: butt, round
and square.

lineJoinstring<optional>
'miter'

The type of drawing used when two lines join. Possible
values are: round, bevel and miter.

miterLimitnumber<optional>
10

The ratio between the miter length and half lineWidth.

Members

lineCap :string

The line ending type (butt, round or square)

Type:
  • string

lineJoin :string

The drawing used when two lines join (round, bevel or miter)

Type:
  • string

lineWidth :number

The line width

Type:
  • number

miterLimit :number

Ratio between the miter length and half lineWidth

Type:
  • number

Methods

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:
  • The resulting object, with minimal attrributes
Type: 
object

setAttributes(data) → {module:AWT.Stroke}

Reads the properties of this Stroke from a data object

Parameters:
NameTypeDescription
dataobject

The data object to be parsed

Returns:
Type: 
module:AWT.Stroke

setStroke(ctx) → {external:CanvasRenderingContext2D}

Sets the properties of this stroke to a CanvasRenderingContext2D

Parameters:
NameTypeDescription
ctxexternal:CanvasRenderingContext2D

The canvas 2D rendering context