The Face Object Field - Draw
←Older revision | Newer revision→
Style/draw provides a DRAW dialect block, when needed. This block specifies the graphical look for objects of a style.
For example, a simple button can be rendered from:
draw: [ pen pen-color line-width 1.5 grad-pen cubic 1x1 0 40 area-fill box 1x1 area-size 3 ]
Notice the use of facets to control the parameters of the draw commands. These facets will be provided by the style/facets and face/facets fields, overlayed in that order.
Note that this use of facet variables is only needed for parameters that the designer needs to be dynamic. All other draw parameters can be directly specified as values.
Variations of the draw block are made by modifying face/facet fields dynamically, then redrawing the face/gob object. In the example above, the PEN-COLOR and AREA-FILL fields are changed based on the state of the button, such as in the OVER or SELECTED cases.
It is suggested that designers avoid creating styles with draw blocks that make every possible parameter a facet field. Keep the draw block simple and easy to understand. In most cases, only a few variations are needed for a range of nice looking styles. (And for skins, it is just as easy to create a new draw block.)