1 /** This file is part of Shapes.
3 ** Shapes is free software: you can redistribute it and/or modify
4 ** it under the terms of the GNU General Public License as published by
5 ** the Free Software Foundation, either version 3 of the License, or
8 ** Shapes is distributed in the hope that it will be useful,
9 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ** GNU General Public License for more details.
13 ** You should have received a copy of the GNU General Public License
14 ** along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 ** Copyright 2008, 2010, 2014 Henrik Tidefelt
21 pth: @defaultunit:1%C | (0cm,0cm)>(^60°)--(^)<(2cm,0.5cm)>(^)--(^)<(3cm,~1cm)--(^)<(6cm,0cm)>(^90°)--(5cm,0.5cm)--(0.5cm,1cm)--cycle
25 /** Topmost, we just stroke the path to show what it looks like with default parameters **/
28 /** The default fill color is black: **/
29 •page << [shift (0,~1*yStep)] [] [fill pth]
32 /** Note the various ways to combine many several bindings, as shown in the following examples that set properties of a stroke. **/
34 /** This way, it is difficult to indent nicely since there is no ampersand associated with the first binding. **/
36 @stroking:[rgb 0.1 0.3 0.2]
39 & @dash:[dashpattern 3mm 2mm 1bp 2mm]
41 [shift (0,~2*yStep)] [] [stroke pth]
43 /** This way, one has to introduce <nullbind>, and indenting is still not an easy question. **/
49 & @dash:[dashpattern 3mm 2mm 1bp 2mm]
51 [shift (0,~2.25*yStep)] [] [stroke pth]
53 /** This way, one has to abandon the good old & way of combining bindings, and learn about the new function <bindings>.
54 ** However, indenting is easy here.
63 @dash:[dashpattern 3mm 2mm 1bp 2mm]
66 [shift (0,~2.5*yStep)] [] [stroke pth]
69 /** The fill color is changed as follows: **/
70 •page << @nonstroking:RGB_BLUE | [shift (0,~3*yStep)] [] [fill pth]
72 /** If a path is both to be filled and stroked, it is efficient to use the fillstroke command,
73 ** here, the ampersand is used instead of the function <bindings>:
76 @nonstroking:GRAY_WHITE
77 & @stroking:[rgb 0.5 0.5 0]
79 [shift (0,~4*yStep)]*[rotate 30°] [] [fillstroke pth]