back-trf.mkiv /size: 1846 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=back-trf,
3%D        version=2019.02.08, % 2009.04.15,
4%D          title=\CONTEXT\ Backend Macros,
5%D       subtitle=Transformations,
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\unprotect
15
16\registerctxluafile{back-trf}{}
17
18% rotation
19
20\unexpanded\def\dostartrotation#1%
21  {\forcecolorhack
22   \clf_startrotation#1\relax} % todo: implement without Q q
23
24\unexpanded\def\dostoprotation
25  {\clf_stoprotation
26   \forcecolorhack}
27
28% scaling
29
30\unexpanded\def\dostartscaling#1#2%
31  {\forcecolorhack
32   \clf_startscaling rx #1 ry #2\relax}
33
34\unexpanded\def\dostopscaling
35  {\clf_stopscaling
36   \forcecolorhack}
37
38% mirroring
39
40\unexpanded\def\dostartmirroring
41  {\clf_startmirroring}
42
43\unexpanded\def\dostopmirroring
44  {\clf_stopmirroring}
45
46% transform
47
48\unexpanded\def\dotransformnextbox#1#2#3#4#5#6%
49  {\dowithnextbox{\dodotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}}}
50
51\unexpanded\def\dodotransformnextbox#1#2#3#4#5#6%
52  {\hpack
53     {\kern #5\onebasepoint
54      \raise#6\onebasepoint
55      \hpack
56        {\clf_startmatrix rx #1 sx #2 sy #3 ry #4\relax
57         \box\nextbox
58         \clf_stopmatrix}}}
59
60%D \macros
61%D   {dostartclipping,dostopclipping}
62%D
63%D Clipping is implemented in such a way that an arbitrary code can be fed.
64%D
65%D \starttyping
66%D \dostartclipping {pathname} {width} {height}
67%D \dostopclipping
68%D \stoptyping
69
70\unexpanded\def\dostartclipping#1#2#3% we can move this to lua and only set a box here
71  {\forcecolorhack
72   \meta_grab_clip_path{#1}{#2}{#3}%
73   \clf_startclipping{\MPclippath}%
74   \glet\MPclippath\empty}
75
76\unexpanded\def\dostopclipping
77  {\clf_stopclipping}
78
79\protect \endinput
80