[NTG-context] Can I share METAPOST vardefs over multiple pages?
Gerben Wierda
gerben.wierda at rna.nl
Fri Mar 13 12:53:46 CET 2020
Suppose I have this code:
\startMPpage
vardef MyShape(expr w, h) =
save pth; path pth ;
save pic; picture pic;
pth = fullsquare xysized (w, h);
pic := image (
draw pth;
% all kind of stuff here
);
setbounds pic to pth;
pic
enddef ;
picture s ; s := MyShape(4cm, 2cm);
draw s;
drawdot center leftboundary s withpen pencircle scaled 2 withcolor green;
drawdot center rightboundary s withpen pencircle scaled 2 withcolor blue;
drawdot point .25 along topboundary s withpen pencircle scaled 2 withcolor yellow;
drawdot .25[llcorner s, lrcorner s] withpen pencircle scaled 2 withcolor magenta;
drawdot origin withpen pencircle scaled 2 withcolor red;
\stopMPpage
Can I reuse that varied across follow-up MPPages?
G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200313/601eb464/attachment.htm>
More information about the ntg-context
mailing list