back-ext.mkxl /size: 3078 b    last modification: 2021-10-28 13:50
1%D \module
2%D   [       file=back-ext,
3%D        version=2019.02.08, % and later, merged file
4%D          title=\CONTEXT\ Backend Macros,
5%D       subtitle=Output,
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% \registerctxluafile{back-ext}{autosuffix}
15
16\unprotect
17
18% \let\normalopenout \openout
19% \let\normalwrite   \write
20% \let\normalcloseout\closeout
21% \let\normallatelua \latelua
22% \let\normalspecial \special
23
24% rotation
25
26% \permanent\protected\def\dostartrotation#1{\forcecolorhack\clf_startrotation#1\relax}
27% \permanent\protected\def\dostoprotation   {\clf_stoprotation\forcecolorhack}
28
29\permanent\protected\def\dostartrotation#1{\clf_startrotation#1\relax}
30\permanent\protected\def\dostoprotation   {\clf_stoprotation}
31
32% scaling
33
34% \permanent\protected\def\dostartscaling#1#2{\forcecolorhack\clf_startscaling rx #1 ry #2\relax}
35% \permanent\protected\def\dostopscaling     {\clf_stopscaling\forcecolorhack}
36
37\permanent\protected\def\dostartscaling#1#2{\clf_startscaling rx #1 ry #2\relax}
38\permanent\protected\def\dostopscaling     {\clf_stopscaling}
39
40% mirroring
41
42\permanent\protected\def\dostartmirroring{\clf_startmirroring}
43\permanent\protected\def\dostopmirroring {\clf_stopmirroring}
44
45% transform
46
47\permanent\protected\def\dotransformnextbox#1#2#3#4#5#6%
48  {\dowithnextbox{\dodotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}}}
49
50\permanent\protected\def\dodotransformnextbox#1#2#3#4#5#6%
51  {\hpack
52     {\kern #5\onebasepoint
53      \raise#6\onebasepoint
54      \hpack
55        {\clf_startmatrix rx #1 sx #2 sy #3 ry #4\relax
56         \box\nextbox
57         \clf_stopmatrix}}}
58
59%D \macros
60%D   {dostartclipping,dostopclipping}
61%D
62%D Clipping is implemented in such a way that an arbitrary code can be fed.
63%D
64%D \starttyping
65%D \dostartclipping {pathname} {width} {height}
66%D \dostopclipping
67%D \stoptyping
68
69\mutable\let\MPclippath\empty
70
71% \permanent\protected\def\dostartclipping#1#2#3% we can move this to lua and only set a box here
72%   {\forcecolorhack
73%    \meta_grab_clip_path{#1}{#2}{#3}%
74%    \clf_startclipping{\MPclippath}%
75%    \glet\MPclippath\empty}
76
77\permanent\protected\def\dostartclipping#1#2#3% we can move this to lua and only set a box here
78  {\meta_grab_clip_path{#1}{#2}{#3}%
79   \clf_startclipping{\MPclippath}%
80   \glet\MPclippath\empty}
81
82\permanent\protected\def\dostopclipping
83  {\clf_stopclipping}
84
85%D This wrapper is needed when you use code that messes with e.g. local color
86%D directives, invisible for the rest of the machinery. It's only needed in very
87%D special cases, like around the above scaler directives:
88
89\permanent\protected\edef\hcontainer{\hpack \s!direction\directionlefttoright \s!container\space}
90\permanent\protected\edef\vcontainer{\vpack \s!direction\directionlefttoright \s!container\space}
91\permanent\protected\edef\tcontainer{\tpack \s!direction\directionlefttoright \s!container\space}
92
93\protect \endinput
94