29.11.2012 Views

MetaFun - Pragma ADE

MetaFun - Pragma ADE

MetaFun - Pragma ADE

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The graphic extends beyond the bounding box, but the bounding box determines the placement<br />

and therefore the spacing around the graphic. We can get rid of the artwork outside the bounding<br />

box by clipping it.<br />

fill fullcircle scaled 2cm withcolor .625yellow ;<br />

clip currentpicture to unitsquare scaled 1cm ;<br />

The resulting picture is just as large but shows less of the picture.<br />

1.18 Some extensions<br />

We will now encounter a couple of transformations that can make your life easy when you use<br />

METAPOST for making graphics like the ones demonstrated in this document. These transformations<br />

are not part of standard METAPOST, but come with METAFUN.<br />

A very handy extension is enlarged. Although you can feed it with any path, it will return a<br />

rectangle larger or smaller than the boundingbox of that path. You can specify a pair or a numeric.<br />

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

drawpath p ; drawpoints p ;<br />

p := (p shifted (3cm,0)) enlarged (.5cm,.25cm) ;<br />

drawpath p ; drawpoints p ;<br />

There are a few more alternatives, like bottomenlarged, rightenlarged, topenlarged and<br />

leftenlarged.<br />

The cornered operator will replace sharp corners by rounded ones (we could not use rounded<br />

because this is already in use).<br />

path p ; p := ((1,0)--(2,0)--(2,2)--(1,2)--(0,1)--cycle)<br />

xysized (4cm,2cm) ;<br />

drawpath p ; drawpoints p ;<br />

p := (p shifted (5cm,0)) cornered .5cm ;<br />

drawpath p ; drawpoints p ;<br />

Some extensions Welcome to MetaPost<br />

51

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

Saved successfully!

Ooh no, something went wrong!