1.12 <GrapheneSize>

Structure: <GrapheneSize>

A size.

Fields

width

the width

height

the height

Procedures

Procedure: size:alloc ⇒ %return

Allocates a new <GrapheneSize>.

The contents of the returned value are undefined.

%return

Returned: a <GrapheneSize>.

the newly allocated <GrapheneSize>

Method: size:equal? self b ⇒ %return
Method: equal? self b ⇒ %return

Checks whether the two give <GrapheneSize> are equal.

self

Passed: a <GrapheneSize>.

a <GrapheneSize>

b

Passed: a <GrapheneSize>.

a <GrapheneSize>

%return

Returned: a boolean.

true if the sizes are equal

Method: size:free self
Method: free self

Frees the resources allocated by size:alloc.

self

Passed: a <GrapheneSize>.

a <GrapheneSize>

Method: size:init self width height ⇒ %return
Method: init self width height ⇒ %return

Initializes a <GrapheneSize> using the given width and height.

self

Passed: a <GrapheneSize>.

a <GrapheneSize>

width

Passed: a real number.

the width

height

Passed: a real number.

the height

%return

Returned: a <GrapheneSize>.

the initialized <GrapheneSize>

Method: size:init-from-size self src ⇒ %return
Method: init-from-size self src ⇒ %return

Initializes a <GrapheneSize> using the width and height of the given src.

self

Passed: a <GrapheneSize>.

a <GrapheneSize>

src

Passed: a <GrapheneSize>.

a <GrapheneSize>

%return

Returned: a <GrapheneSize>.

the initialized <GrapheneSize>

Method: size:interpolate! self b factor res ⇒ res
Method: interpolate! self b factor res ⇒ res

Linearly interpolates the two given <GrapheneSize> using the given interpolation factor.

self

Passed: a <GrapheneSize>.

a <GrapheneSize>

b

Passed: a <GrapheneSize>.

a <GrapheneSize>

factor

Passed: a real number.

the linear interpolation factor

res

Passed, filled in, and returned: a <GrapheneSize>.

return location for the interpolated size

Method: size:scale! self factor res ⇒ res
Method: scale! self factor res ⇒ res

Scales the components of a <GrapheneSize> using the given factor.

self

Passed: a <GrapheneSize>.

a <GrapheneSize>

factor

Passed: a real number.

the scaling factor

res

Passed, filled in, and returned: a <GrapheneSize>.

return location for the scaled size

Procedure: size:zero ⇒ %return

A constant pointer to a zero <GrapheneSize>, useful for equality checks and interpolations.

%return

Returned: a <GrapheneSize>.

a constant size