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.

190<br />

12<br />

such a feature at a higher abstraction level is not only more portable, but also less sensitive for<br />

misinterpretation.<br />

vardef ColorCircle (expr method, factor, ca, cb, cc) =<br />

save u, p ; path p ; p := fullcircle shifted (1/4,0) ;<br />

image<br />

( fill p rotated 90 withcolor transparent(method,factor,ca) ;<br />

fill p rotated 210 withcolor transparent(method,factor,cb) ;<br />

fill p rotated 330 withcolor transparent(method,factor,cc) )<br />

enddef ;<br />

draw ColorCircle ("normal", .5, red, green, blue) xsized 3cm ;<br />

currentpicture := currentpicture shifted (-4cm,0) ;<br />

draw ColorCircle ("exclusion", .5, red, green, blue) xsized 3cm ;<br />

currentpicture := currentpicture shifted (-4cm,0) ;<br />

draw ColorCircle ("exclusion", 1, red, green, blue) xsized 3cm ;<br />

color xcyan ; xcyan := cmyk(1,0,0,0) ;<br />

color xmagenta ; xmagenta := cmyk(0,1,0,0) ;<br />

color xyellow ; xyellow := cmyk(0,0,1,0) ;<br />

draw ColorCircle ("exclusion", .5, xcyan, xmagenta, xyellow) xsized 3cm ;<br />

You can be tempted to use transparency as a convenient way to achieve soft colors. In that case<br />

you should be aware of the fact that rendering transparent colors takes more time than normal<br />

colors 12<br />

Fortunatey, METAPOST provides a similar mechanism. The last circle in the following row demonstrates<br />

how we can trigger colors proportionally to other colors. Normally background is white,<br />

but you can set predefined color variables to another value.<br />

path p ; p := fullcircle scaled 2cm ;<br />

fill p shifted (0cm,0) withcolor blue ;<br />

When your printer does not support this feature natively, the intermediate (POSTSCRIPT) file send to the printing engine is<br />

also larger.<br />

Special effects Transparency

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

Saved successfully!

Ooh no, something went wrong!