Download METAFUN manual

Transcript
Page 330
Shading
sh := define_circular_shade
(origin,origin,0,8cm,\MPcolor{a},\MPcolor{b}) ;
for i=0 step 2cm until 8cm :
fill fullcircle scaled 1cm shifted (i,0) withshade sh ;
endfor ;
The low level macro define_circular_shade is fed with two pairs (points), two radius, and two colors. The
shade is distributed between the colors according to the radius.
Shading can hardly be called an easy issue. The macros that we provide here are in fact simplifications, which
means that at a lower level, one can do more advanced things. Here we limit ourselves to the more common
cases. In the previous examples, we used an arrow to indicate the direction and magnitude of the shade. The
next macro demonstrates the principles in a different way.
def test_shade (expr a, b, ra, rb) =
pickup pencircle scaled 1mm ;
color ca ; ca := \MPcolor{a} ;
color cb ; cb := \MPcolor{b} ;
color cc ; cc := \MPcolor{c} ;
path pa ; pa := fullcircle scaled 2ra shifted a ;
path pb ; pb := fullcircle scaled 2rb shifted b ;
Special effects
exit content index reference Í É Ê Î