type

Stroke

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

Stroke defines the how to render shape outlines.

constructors

fromStr

Parse from string format

make

Make with an it-block

makeFields

Make with fields

fields

cap

How to render line end caps.

dash

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

defVal

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

join

How to render line joins.

none

Value with width of zero

width

Stroke width.

methods

equals

Equality is based on fields

hash

Hash is based on fields

isNone

Is the width set to zero

toSize

Return this stroke with different width.

toStr

Return string format - see fromStr

Slot Details

cap

src const StrokeCap cap := StrokeCap.butt

How to render line end caps. Default is butt.

dash

src const Str? dash

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

defVal

src const static Stroke defVal := makeFields

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

equals

src virtual override Bool equals(Obj? obj)

Equality is based on fields

fromStr

src static new fromStr(Str s, Bool checked := true)

Parse from string format:

width [dash] cap join

Examples:

0.5
2 [1, 2]
round radius

hash

src virtual override Int hash()

Hash is based on fields

isNone

src Bool isNone()

Is the width set to zero

join

src const StrokeJoin join := StrokeJoin.miter

How to render line joins. Default is miter.

make

src new make(|This| f)

Make with an it-block

makeFields

src new makeFields(Float width := 1.0f, Str? dash := null, StrokeCap cap := StrokeCap.butt, StrokeJoin join := StrokeJoin.miter)

Make with fields

none

src const static Stroke none := Stroke.makeFields(0.0)

Value with width of zero

toSize

src Stroke toSize(Float newWidth)

Return this stroke with different width.

toStr

src virtual override Str toStr()

Return string format - see fromStr

width

src const Float width := 1.0f

Stroke width. Default is 1.