Changes between Version 3 and Version 4 of DrawingCommands


Ignore:
Timestamp:
Dec 17, 2011, 8:56:00 PM (13 years ago)
Author:
cinc
Comment:

Commands for line drawing added

Legend:

Unmodified
Added
Removed
Modified
  • DrawingCommands

    v3 v4  
    11= Drawing Commands of the Icon Engine =
    22
    3 === Save/restore current context ===
     3== Save/restore current context ==
    44
    55{{{
     
    1414See the [IconTutorial Icon Tutorial] for an example.
    1515
    16 === Moving paint position for images ===
    17 
    18 {{{ 
    19 <transl>x y</>
    20 
    21    Specify the position for the next image command.
    22 }}}
    23 
    24 ''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.
    25 
    26 See the [IconTutorial Icon Tutorial] for an example.
    27 
    28 Note that for other drawing commands the position is set using ''<move></>''.
    29 
    30 === Setting colors ===
     16== Setting colors ==
    3117
    3218{{{ 
     
    6147}}}
    6248
    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
     57This 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
     62For 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
     70For 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
     76The 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
     86The 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
     97The 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
     118There are two commands doing the actual drawing of the line.
     119
     120{{{ 
     121<stroke></>
     122
     123   Do the actual drawing.
     124}}}
     125
     126Using ''<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
     136It 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
     141Painting 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
     153See the [IconTutorial Icon Tutorial] for an example.
     154
     155Note that for other drawing commands the position is set using ''<move></>''.
     156
     157
     158=== Sizing the image ===
    64159
    65160{{{ 
     
    74169See the [IconTutorial Icon Tutorial] for an example.
    75170
    76 === Using Images ===
     171
     172=== Painting the image ===
    77173
    78174{{{