63 | | === Sizing === |
| 49 | == Move the drawing position == |
| 50 | |
| 51 | {{{ |
| 52 | <move>Xpos Ypos</> |
| 53 | |
| 54 | Move to the position ''xpos/yPos'' on the current surface. |
| 55 | }}} |
| 56 | |
| 57 | This command specifies the position where the next drawing command will take place. The command may be drawing of an rectangle, a line, text or something else. |
| 58 | |
| 59 | |
| 60 | == Drawing a line == |
| 61 | |
| 62 | For drawing a line one has to perform a sequence of commands: |
| 63 | |
| 64 | * Move to the start position using ''<move>Xpos Ypos</>'' |
| 65 | * Set the line width using ''<lwidth>width</>'' |
| 66 | * Optionally specify how to paint line endpoints using ''<linecap></>'' |
| 67 | * Set the end point using '<line>toX toY</>'' |
| 68 | * Finally drawing the line using ''<stroke></>'' |
| 69 | |
| 70 | For example: |
| 71 | |
| 72 | {{{ |
| 73 | <color>0.5 0.5 0.9</><lwidth>0.05</><move>0.1 0.3</><line>0.8 0.9</><stroke></> |
| 74 | }}} |
| 75 | |
| 76 | The commands will be described in detail in the following paragraphs. |
| 77 | |
| 78 | === Set line width === |
| 79 | |
| 80 | {{{ |
| 81 | <lwidth>width</> |
| 82 | |
| 83 | Set the width for subsequently drawn lines. |
| 84 | }}} |
| 85 | |
| 86 | The value may range from 0.0 to 1.0. |
| 87 | |
| 88 | |
| 89 | === Set the shape of the lines end point === |
| 90 | |
| 91 | {{{ |
| 92 | <linecap>style</> |
| 93 | |
| 94 | Draw the end point of a line using ''style''. |
| 95 | }}} |
| 96 | |
| 97 | The parameter ''style'' may be one of: |
| 98 | |
| 99 | {{{ |
| 100 | round: the line start/end point is rounded with the center of the circle specified |
| 101 | by the given x/y position |
| 102 | square: the line start or end point is a square with the center specified by the |
| 103 | given x/y point |
| 104 | butt: the line starts and ends exactly at the specified positions |
| 105 | }}} |
| 106 | |
| 107 | === Set next line point === |
| 108 | |
| 109 | {{{ |
| 110 | <line>toX toY</> |
| 111 | |
| 112 | Draw a line from the current position to toX/toY. |
| 113 | }}} |
| 114 | |
| 115 | |
| 116 | === Perform the line drawing === |
| 117 | |
| 118 | There are two commands doing the actual drawing of the line. |
| 119 | |
| 120 | {{{ |
| 121 | <stroke></> |
| 122 | |
| 123 | Do the actual drawing. |
| 124 | }}} |
| 125 | |
| 126 | Using ''<stroke></>'' all information about the painted path (start position, line segments, width etc.) is cleared from the curent context. This means for example one has to issue a new ''move'' command prior to any more line drawing. |
| 127 | |
| 128 | {{{ |
| 129 | <stroke>preserve</> |
| 130 | |
| 131 | Do the actual drawing but keep all line information in the context. |
| 132 | }}} |
| 133 | |
| 134 | ''<stroke>preserve</>'' will keep all the path information in the drawing context. Subsequent drawing will take place at the last position specified by one of the drawing commands. |
| 135 | |
| 136 | It is possible to do several ''move'' and ''line'' commands on a surface. The actual drawing only takes place when performing the ''stroke'' command. |
| 137 | |
| 138 | |
| 139 | == Using Images == |
| 140 | |
| 141 | Painting of images is done with some special commands described here. |
| 142 | |
| 143 | === Moving paint position for images === |
| 144 | |
| 145 | {{{ |
| 146 | <transl>x y</> |
| 147 | |
| 148 | Specify the position for the next image command. |
| 149 | }}} |
| 150 | |
| 151 | ''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. |
| 152 | |
| 153 | See the [IconTutorial Icon Tutorial] for an example. |
| 154 | |
| 155 | Note that for other drawing commands the position is set using ''<move></>''. |
| 156 | |
| 157 | |
| 158 | === Sizing the image === |