Struct Length

Represents length with specified measurement unit

struct Length

Constructors

NameDescription
this (value, type) Construct with some value and type

Methods

NameDescription
is_em ()
is_percent ()
is_rem ()
opBinary (u)
opBinary (factor)
opEquals (u)
toDevice () For absolute units - converts them to device pixels, for relative - multiplies by 100
toLayout () Convert to layout length, which represents device-independent pixels or percentage

Static methods

NameDescription
cm (value)
device (value) Construct with raw device pixels
dipToDevice (dips) Convert device-independent pixels to physical device pixels (of current window)
em (value)
inch (value)
mm (value)
parse (value, unit) Parse pair (value, unit), where value is a real number, unit is: cm, mm, in, pt, px, em, %. Returns Length.none if cannot parse.
percent (value)
pt (value)
px (value)
rem (value)