/** This file is part of Shapes.
**
** Shapes is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** any later version.
**
** Shapes is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Shapes. If not, see .
**
** Copyright 2008, 2010, 2014 Henrik Tidefelt
**/
##lookin ..Shapes
##lookin ..Shapes..Geometry
pth: Geometry..@defaultunit:1%C | (0cm,0cm)>(^60°)--(^)<(2cm,0.5cm)>(^)--(^)<(3cm,~1cm)--(^)<(6cm,0cm)>(^90°)--(5cm,0.5cm)--(0.5cm,1cm)--cycle
yStep: 2cm
/** Topmost, we just stroke the path to show what it looks like with default parameters **/
IO..•page << [Graphics..stroke pth]
/** The default fill color is black: **/
IO..•page << [shift (0,~1*yStep)] [] [Graphics..fill pth]
/** Note the various ways to combine many several bindings, as shown in the following examples that set properties of a stroke. **/
/** This way, it is difficult to indent nicely since there is no ampersand associated with the first binding. **/
IO..•page <<
Traits..@stroking:[Traits..rgb 0.1 0.3 0.2]
& Traits..@width:2bp
& Traits..@cap:Traits..Cap..SQUARE
& Traits..@dash:[Traits..dashpattern 3mm 2mm 1bp 2mm]
|
[shift (0,~2*yStep)] [] [Graphics..stroke pth]
/** This way, one has to introduce , and indenting is still not an easy question. **/
IO..•page <<
nullbind
& Traits..@stroking:Traits..RGB..BLUE
& Traits..@width:2bp
& Traits..@cap:Traits..Cap..BUTT
& Traits..@dash:[Traits..dashpattern 3mm 2mm 1bp 2mm]
|
[shift (0,~2.25*yStep)] [] [Graphics..stroke pth]
/** This way, one has to abandon the good old & way of combining bindings, and learn about the new function .
** However, indenting is easy here.
**/
IO..•page <<
[bindings
Traits..@stroking:Traits..RGB..GREEN
Traits..@width:1mm
Traits..@cap:Traits..Cap..ROUND
Traits..@join:Traits..Join..MITER
Traits..@miterlimit:4.5
Traits..@dash:[Traits..dashpattern 3mm 2mm 1bp 2mm]
]
|
[shift (0,~2.5*yStep)] [] [Graphics..stroke pth]
/** The fill color is changed as follows: **/
IO..•page << Traits..@nonstroking:Traits..RGB..BLUE | [shift (0,~3*yStep)] [] [Graphics..fill pth]
/** If a path is both to be filled and stroked, it is efficient to use the fillstroke command,
** here, the ampersand is used instead of the function :
**/
IO..•page <<
Traits..@nonstroking:Traits..BW..WHITE
& Traits..@stroking:[Traits..rgb 0.5 0.5 0]
|
[shift (0,~4*yStep)]*[rotate 30°] [] [Graphics..fillstroke pth]