Next: , Previous: Windows and views, Up: Scheme



6.14 Propertial functions

Property values can also be accessed from Scheme. Each property value type has some external representation, which is used for setting and getting the value of the property. For real numbers, booleans and strings it is easy, other property value types use a list with symbols (as identifiers of the property value type) in the first position:

(natural n)
where n is a natural number.
(rgb r g b)
where r, g, b are values from 0 to 255, the color is solid.
(rgba r g b a)
where r, g, b, a are values from 0 to 255.
(font font-family font-style)
where font-family and font-style are strings.
(cap-style symbol)
where symbol is one of: butt, round, projecting
(join-style symbol)
where symbol is one of: miter, round, bevel
(alignment-x symbol)
where symbol is one of: ref-left, ref-center, ref-right, ref-relative, bbox-left, bbox-center, bbox-right, bbox-relative
(alignment-y symbol)
where symbol is one of: baseline, bbox-left, bbox-center, bbox-right, bbox-relative
(arrow-front symbol)
where symbol is one of: straight, parabolic
(arrow-back symbol)
where symbol is one of: none, straight, poly, parabolic
(arrow-alignment symbol)
where symbol is one of: front, back

There exist even more types, but these are the most useful.

For example, to set the fill color to magenta for an object g, you should run:

     (set-property! g 'fill-color '(rgb 127 255 0))


(get-property o name [missing])
o symbol [any] -> specific
Returns the value of the property name of o or (missing or false if missing is not set) if no such property exists.


(set-property! o name value)
obj + go symbol specific -> unspecified
Sets the property name of the object o to value. The property is created if no such property exists.


(get-conic g)
elliptic-arc -> list
Returns the list with arc information (see Elliptic arcs) about g. In the list there is the value of the conic property and other associated properties (start, dif) if they are meaningful.


(set-conic! g conic ...)
elliptic-arc symbol ... -> unspecified
Sets the arc information (see Elliptic arcs) of g. It sets the conic property to conic and the other associated properties (start, dif), which should be given as arguments when they are needed.