Debian Codegraph @

texmf-dist/tex/generic/tikz-ext/pgflibraryext.shapes.circlecrosssplit.code.tex

raw
1 % Copyright 2022 by Qrrbrbirlbel
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Free Documentation License.
7 %
8 \usepgflibrary{shapes.multipart}
9 \unless\ifcsname pgfextset\endcsname
10 \input tikzext-util.tex
11 \fi
12
13 \let\pgfnodeparttrbox\pgfnodeparttwobox
14 \let\pgfnodepartblbox\pgfnodepartthreebox
15 \let\pgfnodepartbrbox\pgfnodepartfourbox
16 \newif\ifpgfextcirclecrosssplitcustomfill
17 \pgfextset{
18 circle cross split part fill/.code=%
19 \def\pgf@lib@sh@ccs@list@fill{#1}%
20 \pgfextcirclecrosssplitcustomfilltrue,%
21 circle cross split uses custom fill/.is if=pgfextcirclecrosssplitcustomfill
22 }
23 \def\pgf@lib@sh@ccs@list@fill{none}%
24 \pgfdeclareshape{ext_circle cross split}{%
25 \nodeparts{text,two,three,four}%
26 \savedanchor\centerpoint{%
27 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
28 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}%
29 \pgf@x =\wd\pgfnodeparttextbox
30 \pgf@yb=\dp\pgfnodeparttextbox
31 \pgf@y=\dp\pgfnodeparttwobox
32 \ifdim\pgf@yb>\pgf@y
33 \pgf@y=\pgf@yb
34 \fi
35 \advance\pgf@x\pgf@xa
36 \advance\pgf@y-\pgf@ya
37 \advance\[email protected]\pgflinewidth
38 \advance\[email protected]\pgflinewidth
39 }%
40 \savedanchor\twoanchor{%
41 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
42 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}%
43 \advance\[email protected]\pgflinewidth
44 \advance\pgf@x\pgf@xa
45 \advance\[email protected]\pgflinewidth
46 \advance\pgf@y\pgf@ya
47 \pgf@yb\dp\pgfnodeparttextbox
48 \pgf@yc\dp\pgfnodeparttwobox
49 \ifdim\pgf@yb>\pgf@yc
50 \pgf@yc\pgf@yb
51 \fi
52 \advance\pgf@y\pgf@yc
53 }%
54 \savedanchor\threeanchor{%
55 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}%
56 \pgf@x\wd\pgfnodeparttextbox
57 \pgf@yb\dp\pgfnodeparttextbox
58 \pgf@yc\dp\pgfnodeparttwobox
59 \ifdim\pgf@yb>\pgf@yc
60 \pgf@yc\pgf@yb
61 \fi
62 \advance\pgf@y-\pgf@yc
63 \advance\pgf@y-2\pgf@ya
64 \advance\pgf@y-\pgflinewidth
65 \pgf@yb\ht\pgfnodepartthreebox
66 \pgf@yc\ht\pgfnodepartfourbox
67 \ifdim\pgf@yb>\pgf@yc
68 \pgf@yc\pgf@yb
69 \fi
70 \advance\pgf@y-\pgf@yc
71 \advance\pgf@x-\wd\pgfnodepartthreebox
72 }%
73 \saveddimen\radius{%
74 % height (upper):
75 \pgf@y=\ht\pgfnodeparttextbox
76 \ifdim\pgf@y<\ht\pgfnodeparttwobox
77 \pgf@y=\ht\pgfnodeparttwobox
78 \fi
79 \ifdim\dp\pgfnodeparttextbox>\dp\pgfnodeparttwobox
80 \advance\pgf@y by\dp\pgfnodeparttextbox
81 \else
82 \advance\pgf@y by\dp\pgfnodeparttwobox
83 \fi
84 % height (lower):
85 \pgf@yb\ht\pgfnodepartthreebox
86 \ifdim\pgf@yb<\ht\pgfnodepartfourbox
87 \pgf@yb=\ht\pgfnodepartfourbox
88 \fi
89 \pgf@yc=\dp\pgfnodepartthreebox
90 \ifdim\pgf@yc<\dp\pgfnodepartfourbox
91 \advance\pgf@yb by\dp\pgfnodepartfourbox
92 \else
93 \advance\pgf@yb by\pgf@yc
94 \fi
95 \ifdim\pgf@yc>\pgf@y
96 \pgf@y=\pgf@yc
97 \fi
98 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}%
99 \advance\pgf@y2\pgf@ya
100 %
101 \pgf@x\wd\pgfnodeparttextbox
102 \pgf@xa\wd\pgfnodepartthreebox
103 \pgf@xb\wd\pgfnodeparttwobox
104 \pgf@xc\wd\pgfnodepartfourbox
105 \ifdim\pgf@xa>\pgf@x
106 \pgf@x\pgf@xa
107 \fi
108 \ifdim\pgf@xb>\pgf@x
109 \pgf@x\pgf@xb
110 \fi
111 \ifdim\pgf@xc>\pgf@x
112 \pgf@x\pgf@xc
113 \fi
114 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
115 \advance\pgf@x by 2\pgf@xa
116 \ifdim\pgf@y>\pgf@x
117 \pgf@x=\pgf@y
118 \fi
119 \advance\pgf@x by\pgflinewidth
120 %
121 \pgf@xa=\pgf@x
122 \pgf@ya=\pgf@y
123 % from circle:
124 \pgf@process{\pgfpointnormalised{}}%
125 \ifdim\pgf@x>\pgf@y%
126 \c@pgf@counta=\pgf@x%
127 \ifnum\c@pgf@counta=0\relax%
128 \else%
129 \divide\c@pgf@counta by 255\relax%
130 \pgf@xa=16\pgf@xa\relax%
131 \divide\pgf@xa by\c@pgf@counta%
132 \pgf@xa=16\pgf@xa\relax%
133 \fi%
134 \else%
135 \c@pgf@counta=\pgf@y%
136 \ifnum\c@pgf@counta=0\relax%
137 \else%
138 \divide\c@pgf@counta by 255\relax%
139 \pgf@ya=16\pgf@ya\relax%
140 \divide\pgf@ya by\c@pgf@counta%
141 \pgf@xa=16\pgf@ya\relax%
142 \fi%
143 \fi%
144 \pgf@x=\pgf@xa%
145 %
146 \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}%
147 \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}%
148 \ifdim\pgf@x<.5\pgf@xb
149 \pgf@x=.5\pgf@xb
150 \fi
151 \ifdim\pgf@x<.5\pgf@yb
152 \pgf@x=.5\pgf@yb
153 \fi
154 %
155 \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
156 \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
157 \ifdim\pgf@xb<\pgf@yb
158 \advance\pgf@x\pgf@yb
159 \else
160 \advance\pgf@x\pgf@xb
161 \fi
162 }%
163 \inheritanchorborder[from=circle]%
164 \inheritanchor[from=circle]{north}%
165 \inheritanchor[from=circle]{north west}%
166 \inheritanchor[from=circle]{north east}%
167 \inheritanchor[from=circle]{center}%
168 \inheritanchor[from=circle]{west}%
169 \inheritanchor[from=circle]{east}%
170 \inheritanchor[from=circle]{mid}%
171 \inheritanchor[from=circle]{mid west}%
172 \inheritanchor[from=circle]{mid east}%
173 \inheritanchor[from=circle]{base}%
174 \inheritanchor[from=circle]{base west}%
175 \inheritanchor[from=circle]{base east}%
176 \inheritanchor[from=circle]{south}%
177 \inheritanchor[from=circle]{south west}%
178 \inheritanchor[from=circle]{south east}%
179 \anchor{two}{\twoanchor}%
180 \anchor{three}{\threeanchor}%
181 \anchor{four}{%
182 \threeanchor
183 \pgf@ya=\pgf@y
184 \twoanchor
185 \pgf@y=\pgf@ya
186 }%
187 \anchor{lower base}{%
188 \threeanchor
189 \pgf@ya=\pgf@y
190 \centerpoint
191 \pgf@y=\pgf@ya
192 }
193 \anchor{lower base west}{%
194 \threeanchor
195 \pgf@ya=\pgf@y
196 \centerpoint
197 \pgf@y=\pgf@ya
198 \advance\pgf@x by-\radius
199 }
200 \anchor{lower base east}{%
201 \threeanchor
202 \pgf@ya=\pgf@y
203 \centerpoint
204 \pgf@y=\pgf@ya
205 \advance\pgf@x by\radius
206 }
207 \anchor{lower mid}{%
208 \threeanchor
209 \pgf@ya=\pgf@y
210 \centerpoint
211 \pgf@y=\pgf@ya
212 \pgfmathsetlength\pgf@ya{+.5ex}%
213 \advance\pgf@y by\pgf@ya
214 }
215 \anchor{lower mid west}{%
216 \threeanchor
217 \pgf@ya=\pgf@y
218 \centerpoint
219 \pgf@y=\pgf@ya
220 \advance\pgf@x by-\radius
221 \pgfmathsetlength\pgf@ya{+.5ex}%
222 \advance\pgf@y by\pgf@ya
223 }
224 \anchor{lower mid east}{%
225 \threeanchor
226 \pgf@ya=\pgf@y
227 \centerpoint
228 \pgf@y=\pgf@ya
229 \advance\pgf@x by\radius
230 \pgfmathsetlength\pgf@ya{+.5ex}%
231 \advance\pgf@y by\pgf@ya
232 }
233 \inheritbackgroundpath[from=circle]
234 \beforebackgroundpath{%
235 \pgfutil@tempdima=\radius
236 \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
237 \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
238 \ifdim\pgf@xb<\pgf@yb
239 \advance\pgfutil@tempdima by-\pgf@yb
240 \else
241 \advance\pgfutil@tempdima by-\pgf@xb
242 \fi
243 \advance\pgfutil@tempdima by-.5\pgflinewidth%
244 \pgfsetshortenstart{0pt}%
245 \pgfsetshortenend{0pt}%
246 \pgfsetarrows{-}%
247 \pgfpathmoveto
248 {\pgfpointadd{\centerpoint}{\pgfqpoint{-\pgfutil@tempdima}{0pt}}}%
249 \pgfpathlineto
250 {\pgfpointadd{\centerpoint}{\pgfqpoint{\pgfutil@tempdima}{0pt}}}%
251 \pgfpathmoveto
252 {\pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{-\pgfutil@tempdima}}}%
253 \pgfpathlineto
254 {\pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{\pgfutil@tempdima}}}%
255 \pgfusepathqstroke
256 }%
257 \behindbackgroundpath{%
258 \pgfutil@tempdima=\radius
259 \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
260 \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
261 \ifdim\pgf@xb<\pgf@yb
262 \advance\pgfutil@tempdima by-\pgf@yb
263 \else
264 \advance\pgfutil@tempdima by-\pgf@xb
265 \fi
266 \advance\pgfutil@tempdima by-.5\pgflinewidth%
267 \ifpgfextcirclecrosssplitcustomfill%
268 \pgf@lib@sh@rs@process@list{\pgf@lib@sh@ccs@list@fill}{4}%
269 {%
270 \pgfmathloop
271 \ifnum\pgfmathcounter>4%
272 \else%
273 \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
274 \edef\pgf@tempa
275 {\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}%
276 \ifx\pgf@tempa\pgf@lib@sh@rs@nonetext\else
277 \pgfsetfillcolor{\pgf@tempa}%
278 \ifcase\pgfmathcounter\or
279 \def\pgf@lib@sh@ccs@angle{90}\or
280 \def\pgf@lib@sh@ccs@angle{0}\or
281 \def\pgf@lib@sh@ccs@angle{180}\else
282 \def\pgf@lib@sh@ccs@angle{270}%
283 \fi
284 \pgfpathmoveto{\centerpoint}%
285 \pgfpathlineto{\pgfpointadd{\centerpoint}
286 {\pgfqpointpolar{\pgf@lib@sh@ccs@angle}{\pgfutil@tempdima}}}%
287 \pgfpatharc{+\pgf@lib@sh@ccs@angle}{\pgf@lib@sh@ccs@angle+90}
288 {+\pgfutil@tempdima}%
289 \pgfpathclose
290 \pgfusepathqfill
291 \fi
292 \repeatpgfmathloop
293 }%
294 \fi
295 }%
296 }
297 %%% Compatibility
298 \pgfkeysifdefined{/tikz/ext/compat/shapes/.@cmd}{}{\pgfextset{/tikz-ext/compat/add library={shapes}{pre 0.6}}}
299 \tikzextset{
300 compat/shapes/warn/.append style=/tikz/ext/compat/shapes.circlecrosssplit/warn,
301 compat/shapes/pre 0.6/.append style=/tikz/ext/compat/shapes.circlecrosssplit/pre 0.6,
302 compat/shapes.circlecrosssplit/warn/.code={%
303 \tikzextutil@compatwarning@key{shapes}{pre 0.6}{/pgf/circle cross split part fill}{/pgf/ext/circle cross split part fill}%
304 \tikzextutil@compatwarning@key{shapes}{pre 0.6}{/pgf/circle cross split part custom fill}[true]{/pgf/ext/circle cross split part fill}%
305 \tikzextutil@compat@cloneshape{circle cross split}{text,north,north west,north east,center,west,east,mid,mid west,mid east,base,base west,base east,south,south west,south east,center,two,three,four,lower mid,lower base,lower mid east,lower base east,lower mid west,lower base west}%
306 \def\tikzext@temp{\tikzextutil@compatmaybewarning{shape 'circle cross split'}{'ext_circle cross split'}{shapes = pre 0.6}}%
307 \expandafter\tikzextutil@prefix@macrotomacro\csname pgf@sh@s@circle cross split\endcsname\tikzext@temp
308 },
309 compat/shapes.circlecrosssplit/pre 0.6/.code={%
310 \pgfkeysdef{/pgf/circle cross split part fill}{\pgfkeysvalueof{/pgf/ext/circle cross split part fill/.@cmd}##1\pgfeov}%
311 \pgfkeysdef{/pgf/circle cross split part custom fill}{\pgfkeysvalueof{/pgf/circle cross split custom part fill/.@cmd}##1\pgfeov}%
312 \pgfkeyssetvalue{/pgf/circle cross split part custom flll/.@def}{true}%
313 \tikzextutil@compat@cloneshape{circle cross split}{text,north,north west,north east,center,west,east,mid,mid west,mid east,base,base west,base east,south,south west,south east,center,two,three,four,lower mid,lower base,lower mid east,lower base east,lower mid west,lower base west}%
314 },
315 compat/shapes.circlecrosssplit/\pgfkeysvalueof{/tikz/ext/compat/shapes}%
316 }