29.11.2012 Views

MetaFun - Pragma ADE

MetaFun - Pragma ADE

MetaFun - Pragma ADE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

188<br />

direction and magnitude of the shade. The next macro demonstrates the principles in a different<br />

way.<br />

def test_shade (expr a, b, ra, rb) =<br />

pickup pencircle scaled 1mm ;<br />

color ca ; ca := \MPcolor{a} ;<br />

color cb ; cb := \MPcolor{b} ;<br />

color cc ; cc := \MPcolor{c} ;<br />

path pa ; pa := fullcircle scaled 2ra shifted a ;<br />

path pb ; pb := fullcircle scaled 2rb shifted b ;<br />

sh := define_circular_shade(a,b,ra,rb,ca,cb) ;<br />

fill pb withshade sh ;<br />

draw pb withcolor cc ;<br />

draw pa withcolor cc ;<br />

enddef ;<br />

The shade is distributed between two circles, each with a radius and center point. All four can be<br />

set, but as the next calls demonstrate, we can normally do with less, which is why we provided<br />

the macro with less parameters.<br />

test_shade(origin, origin, 0cm, 1cm) ;<br />

test_shade(origin, origin, .25cm, 1cm) ;<br />

test_shade(origin, origin, .50cm, 1cm) ;<br />

test_shade(origin, origin shifted (.25cm,0), 0cm, 1cm) ;<br />

test_shade(origin, origin shifted (.25cm,0), .25cm, 1cm) ;<br />

test_shade(origin, origin shifted (.25cm,0), .50cm, 1cm) ;<br />

Special effects Shading

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!