summaryrefslogtreecommitdiff
path: root/info/examples/lgc2/4-1-12.mp
blob: 0d5d905b90c8b9b1299545f6cbbf45526802e0c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
% --- start of displayed preamble in the book ---
input hatching;
% star macro defined as above
% --- end of displayed preamble in the book ---

% graphic converted to gray in book using 'color2gray'

vardef star(expr n) =
 for i_:=0 upto 2n-1:
  if odd i_: 1/2 fi (right rotated (180*(i_/n))) --
 endfor cycle
enddef;

defaultfont:="ptmr8r";
warningcheck:=0;
beginfig(1)
path p;
p:=star(10) xscaled 30mm
            yscaled 20mm
            rotated 20;
interim hatch_match:=0;
hatchoptions(withcolor blue
             dashed evenly scaled 2);
hatchfill p withcolor .75white
            withcolor (20,6bp,-.5bp);
hatchoptions(withcolor (blue+green)
             dashed evenly
             shifted (3/2bp,0));
hatchfill p withcolor (110,6bp,-.5bp);
endfig;
end;