1%D \module 2%D [ file=meta-fig, 3%D version=2000.09.07, 4%D title=\METAPOST\ Graphics, 5%D subtitle=Stand Alone Graphics, 6%D author=Hans Hagen, 7%D date=\currentdate, 8%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] 9%C 10%C This module is part of the \CONTEXT\ macro||package and is 11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for 12%C details. 13 14\writestatus{loading}{MetaPost Graphics / Stand Alone Graphics} 15 16\unprotect 17 18%D This module implements a method for defining stand||alone||graphics, that is, 19%D each graphic gets is own page. Because graphics are wrapped in a \type {\framed}, 20%D you can add overlays to the graphic directly, and since the whole \CONTEXT\ 21%D machinery is available, you can also add page backgrounds. 22%D 23%D \starttyping 24%D \setupMPpage 25%D [offset=1pt, 26%D background=color, 27%D backgroundcolor=green] 28%D 29%D \startMPpage 30%D fill fullcircle scaled 10cm withcolor red ; 31%D \stopMPpage 32%D 33%D \startMPpage 34%D fill fullsquare rotated 45 scaled 8cm withcolor blue ; 35%D \stopMPpage 36%D \stoptyping 37%D 38%D Although this is hardly of any use, you can mix these definitions with the text 39%D flow, since all settings are kept local. The page is clipped to the image size. 40 41\definefittingpage 42 [MPpage] 43 [\c!align=, 44 \c!command=\meta_process_graphic_command, 45 \c!stacking=, 46 \c!instance=] 47 48\permanent\protected\def\setupMPpage 49 {\setupfittingpage[MPpage]} 50 51\protected\def\meta_process_graphic_command 52 {\meta_process_graphic_instance 53 {\fittingpageparameter\c!instance}% 54 {\fittingpageparameter\c!stacking}} 55 56%D \macros 57%D {MPfigure} 58%D 59%D A bit out of place, here but nevertheless: 60 61\permanent\protected\def\MPfigure#1#2% test for dup figure, can be replaced by a textext 62 {\bgroup 63 \getfiguredimensions[#1]% [\c!object=\v!no] already set 64 65 draw externalfigure "#1" 66 xsized \the\dimexpr\figurewidth \relax\space % must be points 67 ysized \the\dimexpr\figureheight\relax\space % must be points 68 #2 ; 69 70 \egroup} 71 72\protect \endinput 73 |