const class gfx::Border

sys::Obj
  gfx::Border

@Js
@Serializable { simple=true }

Source

Modes width, style, color, and radius of a rectangular border.

colorBottom

const Color colorBottom := black

Source

Color of bottom side, default is black.

colorLeft

const Color colorLeft := black

Source

Color of left side, default is black.

colorRight

const Color colorRight := black

Source

Color of right side, default is black.

colorTop

const Color colorTop := black

Source

Color of top side, default is black.

copy

new copy(Border orig, |This| f)

Source

Copy border with some modifications

defVal

const static Border defVal := Border.fromStr("0")

Source

Default is zero pixel border.

equals

virtual override Bool equals(Obj? obj)

Source

Equality is based on string format.

fromStr

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

Source

Parse a border from string (see toStr). If invalid and checked is true then throw ParseErr otherwise return null. The string formatted as four optional parts, where each part may have 1 to 4 values:

border := [width] [style] [color] [radius]
width  := top ["," right ["," bottom ["," left]]]
style  := top ["," right ["," bottom ["," left]]]
color  := top ["," right ["," bottom ["," left]]]
radius := top-left ["," top-right ["," bottom-right ["," bottom-left]]]

Width and radius must be integers, color must match Color string format, and style must be "solid", "inset", or "outset". If one side is not specified, it is reflected from the opposite side:

a      =>  a,a,a,a
a,b    =>  a,b,a,b
a,b,c  =>  a,b,c,b

Examples:

Border("2")          =>  2 solid #000000 0
Border("#abc")       =>  1 solid #aabbcc 0
Border("2 inset 3")  =>  2 inset #000000 3
Border("0,1,2,3")    =>  0,1,2,3 solid #000000 0
Border("0,1,2 #00f") =>  0,1,2 solid #0000ff 0
hash

virtual override Int hash()

Source

Hash is based on string format.

make

new make(|This| f)

Source

Construct with it-block

radiusBottomLeft

const Int radiusBottomLeft := 0

Source

Radius in pixels of bottom-left corner, default is 0.

radiusBottomRight

const Int radiusBottomRight := 0

Source

Radius in pixels of bottom-right corner, default is 0.

radiusTopLeft

const Int radiusTopLeft := 0

Source

Radius in pixels of top-left corner, default is 0.

radiusTopRight

const Int radiusTopRight := 0

Source

Radius in pixels of top-right corner, default is 0.

styleBottom

const Int styleBottom := styleSolid

Source

Style of bottom side as one of styleX constants, default is solid.

styleFromStr

const static Int? styleFromStr(Str s, Bool checked := true)

Source

Parse style string into int constant - see styleToStr.

styleInset

const static Int styleInset := 1

Source

Constant identifier for inset style.

styleLeft

const Int styleLeft := styleSolid

Source

Style of left side as one of styleX constants, default is solid.

styleOutset

const static Int styleOutset := 2

Source

Constant identifier for outside style.

styleRight

const Int styleRight := styleSolid

Source

Style of right side as one of styleX constants, default is solid.

styleSolid

const static Int styleSolid := 0

Source

Constant identifier for solid style.

styleToStr

const static Str styleToStr(Int s)

Source

Return "solid", "inset", "outset" for int constant.

styleTop

const Int styleTop := styleSolid

Source

Style of top side as one of styleX constants, default is solid.

toSize

Size toSize()

Source

Return widthRight+widthLeft, widthTop+widthBottom

toStr

virtual const override Str toStr

Source

String format - see fromStr for format.

widthBottom

const Int widthBottom := 1

Source

Width in pixels of bottom side, default is 1.

widthLeft

const Int widthLeft := 1

Source

Width in pixels of left side, default is 1.

widthRight

const Int widthRight := 1

Source

Width in pixels of right side, default is 1.

widthTop

const Int widthTop := 1

Source

Width in pixels of top side, default is 1.