const class gfx::Pen

sys::Obj
  gfx::Pen

@Js
@Serializable { simple=true }

Source

Pen defines how a shape is stroked.

cap

const Int cap := capSquare

Source

Defines how two ends of unjoined segements are stroked. Valid values are capSquare, capButt, and capRound. Default is capSquare.

capButt

const static Int capButt := 1

Source

Constant for cap

capRound

const static Int capRound := 2

Source

Constant for cap

capSquare

const static Int capSquare := 0

Source

Constant for cap

capToStr

Str capToStr()

Source

Return "square", "butt", "round"

dash

const Int[]? dash

Source

Dash pattern as on/off again lengths. If null then shapes are stroked solid.

Note: dashes not supported in javascript

defVal

const static Pen defVal := Pen.make() |Pen->Void| { ... }

Source

Default pen is width of 1 with capSquare and joinMiter.

equals

virtual override Bool equals(Obj? obj)

Source

Equality is based on Pen's fields.

fromStr

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

Source

Parse a pen from string (see toStr). If invalid and checked is true then throw ParseErr otherwise return null.

hash

virtual override Int hash()

Source

Hash the fields.

join

const Int join := joinMiter

Source

Defines how two path segments are joined at the endpoints. Valid values are joinMiter, joinRound, and joinBevel. Default is joinMiter.

joinBevel

const static Int joinBevel := 1

Source

Constant for join

joinMiter

const static Int joinMiter := 0

Source

Constant for join

joinRound

const static Int joinRound := 3

Source

Constant for join

joinToStr

Str joinToStr()

Source

Return "miter", "round", "bevel"

make

new make(|This| f)

Source

Construct with it-block

toStr

virtual override Str toStr()

Source

Return "width cap join dash" such as "2 capButt joinBevel [1,1]". Omit cap, join, or dash if at defaults.

width

const Int width := 1

Source

Width of the stroke, default is 1.