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