1
2
3\environment canbedonestyle
4
5
6
7\startdocument
8 [title=clipping,
9 color=darkgreen]
10
11\startsectionlevel[title=Clipping]
12
13The feature below is rather \PDF\ specific. Inside a graphic group we
14can register text as clipping path and apply that to what follows. We show
15a few approaches:
16
17\startbuffer
18\newbox \MyBox
19\newdimension\MyDimenA
20\newdimension\MyDimenB
21
22\setbox\MyBox\hbox{\bfd\setstrut\strut\starteffect[clip]JUST SOME TEXT\stopeffect}
23
24\MyDimenA\wd \MyBox
25\MyDimenB\htdp\MyBox
26
27\startgraphicgroup
28 \startoverlay
29 {\box\MyBox}
30 {\externalfigure[hacker.jpg][width=\MyDimenA,height=\MyDimenB]}
31 \stopoverlay
32\stopgraphicgroup
33\stopbuffer
34
35\typebuffer[option=tex]
36
37We get:
38
39\startlinecorrection
40\getbuffer
41\stoplinecorrection
42
43Here we use a helper:
44
45\startbuffer
46\startclipeffect
47 {\hbox to 9cm{\hss\bfd\setstrut\strut
48 \starteffect[clip]JUST SOME TEXT\stopeffect\hss}}
49 {\externalfigure[hacker.jpg][width=9cm,height=1cm]}
50\stopclipeffect
51\stopbuffer
52
53\typebuffer[option=tex]
54
55We get:
56
57\startlinecorrection
58\ruledhbox{\getbuffer}
59\stoplinecorrection
60
61A bit easier is this:
62
63\startbuffer
64\defineoverlay
65 [hacker]
66 [\overlayfigure{hacker.jpg}]
67
68\startgraphicgroup
69\framed
70 [background={foreground,hacker},align={middle,lohi},width=.8tw]
71 {\starteffect[clip]\samplefile{tufte}\stopeffect}
72\stopgraphicgroup
73\stopbuffer
74
75\typebuffer[option=tex]
76
77As you see, we can use more text:
78
79\startlinecorrection
80\getbuffer
81\stoplinecorrection
82
83Finally we introduce:
84
85\startbuffer
86\defineoverlay
87 [hacker]
88 [\overlayfigure{hacker.jpg}]
89
90\startclipframed
91 [background={foreground,hacker},align={middle,lohi},width=.8tw]
92 \samplefile{ward}
93\stopclipframed
94\stopbuffer
95
96\typebuffer[option=tex]
97
98This hides most of the ugly hackery and gives:
99
100\startlinecorrection
101\getbuffer
102\stoplinecorrection
103
104\stopsectionlevel
105
106\stopdocument
107 |