class

Stroke

@Js
@Serializable { simple=true }
const class Stroke : Obj

Stroke defines the how to render shape outlines.

constructors fromStr

Parse from string format

makeFields

Make with fields

make

Make with an it-block

fields cap

How to render line end caps

width

Stroke width

join

How to render line joins

none

Value with width of zero

dash

Dash pattern as space/comma separated numbers of dashes and gaps

defVal

Default value is width 1, no dash, butt cap, miter join

methods toStr

Return string format - see fromStr

isNone

Is the width set to zero

equals

Equality is based on fields

scale

Scale size and dash pattern by given ratio

toSize

Return this stroke with different width

hash

Hash is based on fields

cap const StrokeCap : cap

How to render line end caps. Default is butt.

dash const Str? : dash

Dash pattern as space/comma separated numbers of dashes and gaps. If null then render as solid line.

defVal const static Stroke : defVal

Default value is width 1, no dash, butt cap, miter join.

equals virtual Bool equals(Obj? obj)

Equality is based on fields

fromStr static new fromStr(Str s, Bool checked)

Parse from string format:

width [dash] cap join

Examples:

0.5
2 [1, 2]
round radius

hash virtual Int hash()

Hash is based on fields

isNone Bool isNone()

Is the width set to zero

join const StrokeJoin : join

How to render line joins. Default is miter.

make new make(|This| f)

Make with an it-block

makeFields new makeFields(Float width, Str? dash, StrokeCap cap, StrokeJoin join)

Make with fields

none const static Stroke : none

Value with width of zero

scale Stroke scale(Float ratio)

Scale size and dash pattern by given ratio

toSize Stroke toSize(Float newWidth)

Return this stroke with different width.

toStr virtual Str toStr()

Return string format - see fromStr

width const Float : width

Stroke width. Default is 1.

Haxall 4.0.5 ∙ 24-Feb-2026 14:33 EST