PreviousNext
Help > REFERENCE OF THE BUILT-IN FUNCTIONS > User Interface and Graphics > shape
shape

Format:                                                                        

shape (int_x, int_y, text_def);

Draw vectored shape described in the text parameter, starting from coordinates (x,y). This method is also known as “turtle graphics”. The text definition consists of a number of micro-commands telling “the turtle” in what direction to do or set the colour for drawing.

Spaces in the definition string are not needed and are ignored during translation, however numbers cannot contain spaces within.

C colour”                             This command sets the drawing colour. The colour can be specified either as decimal or hexadecimal number (starting with an ‘x’ character). In case of hexadecimal, the leading ‘0’ character is only optional.

 

F”                                          Flood fill an area starting from the pixel ate the current coordinates. The area is then filled with the last colour set by the ‘C’ command. The colour parameter is given following the same rules as for the ‘C’ command.

 

N”                                         Set transparent drawing colour. This is used when the drawing pen needs to be lifted in order to go somewhere else without drawing on the way there.

 

M [stepsX] , [stepsY]”     Move in specified direction for number of horizontal and vertical steps. The steps are provided as a decimal number that can be positive or negative.

                                                There is two parameters to this micro-command, and they are separated by a comma. The first parameter defines horizontal displacement, and the second one defines vertical displacement. If any of the parameters is not needed, it can be omitted, but the presence of the comma is important to ensure the place of the parameter.

 

Example:

 

shape ( 60, 30,  "Cxff0000 M10,20 M20,10 M-20,10 M-10,20 Cx00ff00 M-10,-20
M-20,-10 M20,-10 M10,-20 NM,15 Cxff M,30 N M-15,-15 Cxff M30,"  );

 

                                    ‘ This definition will draw a four-rayed star with green left
‘ part and red right part, and a blue cross inside, starting from
‘ the top point at coordinates (60,30)