type

Stroke

@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

const StrokeCap cap := StrokeCap.butt

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 := makeFields

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

equals

virtual override Bool equals(Obj? obj)

Equality is based on fields

fromStr

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

virtual override Int hash()

Hash is based on fields

isNone

Bool isNone()

Is the width set to zero

join

const StrokeJoin join := StrokeJoin.miter

How to render line joins. Default is miter.

make

new make(|This| f)

Make with an it-block

makeFields

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

Make with fields

none

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

Value with width of zero

toSize

Stroke toSize(Float newWidth)

Return this stroke with different width.

toStr

virtual override Str toStr()

Return string format - see fromStr

width

const Float width := 1.0f

Stroke width. Default is 1.