summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/meta-imp-clp.mkiv
blob: 5c9206deee911ef23ebd422f4abbecf973bd8c7a (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
%D \module
%D   [       file=meta-clp,
%D        version=2000.07.06,
%D          title=\METAPOST\ Graphics,
%D       subtitle=Clipping,
%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.

%D In this library, we define a bunch of clipping paths that
%D can be fed to \type {\clip}.

\startMPclip{ellipse}
  clip currentpicture to unitcircle
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{negellipse}
  clip currentpicture to (unitcircle peepholed unitsquare)
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{urellipse}
  clip currentpicture to urcircle scaled 2
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{ulellipse}
  clip currentpicture to ulcircle scaled 2 shifted (1,0)
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{llellipse}
  clip currentpicture to llcircle scaled 2 shifted (1,1)
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{lrellipse}
  clip currentpicture to lrcircle scaled 2 shifted (0,1)
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{tellipse}
  clip currentpicture to tcircle shifted (.5,0) yscaled 2
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{bellipse}
  clip currentpicture to bcircle shifted (.5,.5) yscaled 2
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{lellipse}
  clip currentpicture to lcircle shifted (.5,.5) xscaled 2
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{rellipse}
  clip currentpicture to rcircle shifted (0,.5) xscaled 2
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{diamond}
  clip currentpicture to unitdiamond
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{negdiamond}
  clip currentpicture to (unitdiamond peepholed unitsquare)
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{urtriangle}
  clip currentpicture to urtriangle scaled 2
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{ultriangle}
  clip currentpicture to ultriangle scaled 2 shifted (1,0)
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{lltriangle}
  clip currentpicture to lltriangle scaled 2 shifted (1,1)
    xscaled \width yscaled \height ;
\stopMPclip

\startMPclip{lrtriangle}
  clip currentpicture to lrtriangle scaled 2 shifted (0,1)
    xscaled \width yscaled \height ;
\stopMPclip

% More efficient:
%
% \def\dosimpleMPclip#1
%   {clip currentpicture to (#1) xscaled \width yscaled \height ;}
%
% \def\simpleMPclip#1#2%
%   {\startMPclip{#1}\dosimpleMPclip{#2}\stopMPclip}
%
% \simpleMPclip {ellipse}    {unitcircle}
% \simpleMPclip {diamond}    {unitdiamond}
%
% \simpleMPclip {negellipse} {unitcircle  peepholed unitsquare}
% \simpleMPclip {negdiamond} {unitdiamond peepholed unitsquare}
%
% \simpleMPclip {urellipse}  {urcircle scaled 2 shifted (0,0)}
% \simpleMPclip {ulellipse}  {ulcircle scaled 2 shifted (1,0)}
% \simpleMPclip {llellipse}  {llcircle scaled 2 shifted (1,1)}
% \simpleMPclip {lrellipse}  {lrcircle scaled 2 shifted (0,1)}
%
% \simpleMPclip {tellipse}   {tcircle shifted (.5,0)  yscaled 2}
% \simpleMPclip {bellipse}   {bcircle shifted (.5,.5) yscaled 2}
% \simpleMPclip {lellipse}   {lcircle shifted (.5,.5) xscaled 2}
% \simpleMPclip {rellipse}   {rcircle shifted (0,.5)  xscaled 2}
%
% \simpleMPclip {urtriangle} {urtriangle scaled 2 shifted (0,0)}
% \simpleMPclip {ultriangle} {ultriangle scaled 2 shifted (1,0)}
% \simpleMPclip {lltriangle} {lltriangle scaled 2 shifted (1,1)}
% \simpleMPclip {lrtriangle} {lrtriangle scaled 2 shifted (0,1)}

%D \in {Figure} [fig:clipping paths] shows which paths are
%D predefined. When applied to a whole picture, their usage
%D is:
%D
%D \starttyping
%D \clip[nx=1,ny=1,mp=ellipse]{some clippable content}
%D \stoptyping
%D
%D \startbuffer
%D \setupclipping  [nx=1,ny=1,x=1,y=1]
%D \setupblackrules[width=2cm,height=1cm]
%D \startcombination[6*3] % \startcombination[6*3]
%D   {\clip[mp=urellipse] {\blackrule}} {urellipse}
%D   {\clip[mp=ulellipse] {\blackrule}} {ulellipse}
%D   {\clip[mp=llellipse] {\blackrule}} {llellipse}
%D   {\clip[mp=lrellipse] {\blackrule}} {lrellipse}
%D   {\clip[mp=ellipse]   {\blackrule}} {ellipse}
%D   {\clip[mp=negellipse]{\blackrule}} {negellipse}
%D   {\clip[mp=tellipse]  {\blackrule}} {tellipse}
%D   {\clip[mp=bellipse]  {\blackrule}} {bellipse}
%D   {\clip[mp=lellipse]  {\blackrule}} {lellipse}
%D   {\clip[mp=rellipse]  {\blackrule}} {rellipse}
%D   {}                                 {}
%D   {}                                 {}
%D   {\clip[mp=urtriangle]{\blackrule}} {urtriangle}
%D   {\clip[mp=ultriangle]{\blackrule}} {ultriangle}
%D   {\clip[mp=lltriangle]{\blackrule}} {lltriangle}
%D   {\clip[mp=lrtriangle]{\blackrule}} {lrtriangle}
%D   {\clip[mp=diamond]   {\blackrule}} {diamond}
%D   {\clip[mp=negdiamond]{\blackrule}} {negdiamond}
%D \stopcombination % \stopcombination
%D \stopbuffer
%D
%D \placefigure % \placefigure
%D   [here][fig:clipping paths]
%D   {The predefined clipping paths.}
%D   {\getbuffer} % {\getbuffer}

\endinput