wiki:DrawingCommands

Version 2 (modified by cinc, 12 years ago) (diff)

Removed confusing colons

Drawing Commands of the Icon Engine

Save/restore current context

<ctxt>save/restore</>

   Save and restore the current paint context.

The icon engine holds internal data defining the current colors, fonts, angle of rotation etc. Some paint commands alter this information in a global way. To preserve a set state the <ctxt> command can be used. It stores all the data on a stack and any changes will be reverted when issuing a <ctx>restore</>.
It is save to have several of these commands in a set of commands. Make sure every save has an associated restore.

See the Icon Tutorial for an example.

Moving the cursor position

<transl>x y</>

   Specify the position for the next paint command.

X and y specify the position on the surface where subsequent painting will take place. 0.0 0.0 is the upper left corner. The values may run from 0.0 to 1.0.

See the Icon Tutorial for an example.

Sizing

<scale>xsize ysize</>

   Apply scaling to the next set of commands.

The values xsize and ysize are factors between 0.0 and 1.0. They specify the size of the items which will be painted afterwards. Note that this scaling is a global setting and will be applied to all paint commands which follow. Use <ctxt>save</> to save current scaling settings. Note that the factors usually have to be rather small. A value of 1.0 does not mean current icon size but is way bigger.

See the Icon Tutorial for an example.

Using Images

<imgkey>imgname # alpha</>

   Paint an image specified by the key 'imgname' on the current surface with an alpha level of 'alpha'.

This command will paint an image at the current position with the current scaling. The value of alpha may run from 0.0 to 1.0 where 1.0 means completely opaque while 0.0 means completely translucent. imgname is the name of a key in the ini file specifiying the image file to be used. The path is a relative one as known from the 'Image' key. Note that the spelling of the key is important and references to keys belonging to other icons are not possible.

See the Icon Tutorial for an example.