Changes between Version 4 and Version 5 of DrawingCommands


Ignore:
Timestamp:
Dec 18, 2011, 11:04:32 AM (12 years ago)
Author:
cinc
Comment:

Description about drawing rectangles

Legend:

Unmodified
Added
Removed
Modified
  • DrawingCommands

    v4 v5  
    107107=== Set next line point ===
    108108
    109 {{{ 
     109{{{
    110110<line>toX toY</>
    111111
     
    135135
    136136It 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== Drawing rectangles ==
     140
     141The engine supports the drawing of rectangles with or without borders.
     142
     143=== Defining the rectangle ===
     144
     145{{{
     146<rect>Xpos yPos width height</>
     147
     148   Draw a rectangle at position 'Xpos/Ypos' with given 'height' and 'width'.
     149}}}
     150
     151Note that nothing is actually painted yet. You need to issue a ''<fill></>'' or ''<stroke></>'' command.
     152
     153
     154=== Fill rectangle ===
     155
     156{{{ 
     157<fill></>
     158
     159   Fill the rectangle with the set color.
     160}}}
     161
     162The color used is the one previously set using the ''<color>'' or ''<colora>'' commands like in this example:
     163
     164{{{
     165<colora> 0 0.3 0.65 0.8</><rect>0.13 0.345 0.7 0.3</><fill></>
     166}}}
     167
     168=== Draw outline rectangle ===
     169
     170Similar to line drawing one has to issue the stroke command to actually draw the outline:
     171
     172{{{ 
     173<stroke></>
     174
     175   Do the actual drawing.
     176}}}
     177
     178or
     179
     180{{{ 
     181<stroke>preserve</>
     182
     183   Do the actual drawing but keep all line information in the context.
     184}}}
     185
     186Note that you have to define the line features prior to this command. You must at least specify the line width:
     187
     188{{{
     189<colora> 0 0.3 0.65 0.8</><rect>0.13 0.345 0.7 0.3</><lwidth>0.05</><stroke></>
     190}}}
     191
     192
     193=== Draw a filled rectangle with border ===
     194
     195Combining the previous commands it is possible to draw rectangles with borders using any combination of color and line with.
     196
     197The following sequence of commands draws a rectangle with a blue semitransparent border filled with a solid grey color:
     198{{{
     199<colora>0 0.3 0.65 0.8</><rect>0.13 0.345 0.7 0.3</><lwidth>0.05</><stroke>preserve</><color>0.5 0.5 0.5</><fill></>
     200}}}
     201
     202Note the use of ''<stroke>preserve</>'' here. This way the information about the rectangle's shape is kept in the current drawing context after drawing the border and the fill command is applied to the same shape.
     203
     204When using ''<stroke></>'' here only the border is drawn because there is no definition for any shape when the ''<fill></>' command is encountered.
    137205
    138206