Debian Codegraph @

texmf-dist/tex/latex/tikzbrickfigurines/tikzbrickfigurines.sty

raw
1 % Author..........: C. Pierquet
2 % licence.........: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt
3
4 \NeedsTeXFormat{LaTeX2e}
5 \ProvidesPackage{tikzbrickfigurines}[2025/08/18 0.1.1 Small brickfigurines, made with tikz]
6
7 %====HISTORY
8 % v 0.1.1 Enhancements for adjusted logo
9 % v 0.1.0 Initial version
10
11 %====PACKAGES
12 \RequirePackage{simplekv}
13 \RequirePackage{xstring}
14 \RequirePackage{ifthen}
15 \RequirePackage{etoolbox}
16 \RequirePackage{listofitems}
17 \RequirePackage{graphicx}
18 \RequirePackage{calc}
19 \RequirePackage{tikz}
20 \usetikzlibrary{shapes.geometric,bbox,decorations,decorations.pathmorphing,calc}
21
22 %https://tex.stackexchange.com/questions/719042/tikz-how-clip-to-complement-of-a-region
23 \usetikzlibrary{spath3}
24 \tikzset{
25 invclip/.style={clip even odd rule,overlay,insert path={[reset cm](-16383.99999pt,-16383.99999pt) rectangle (16383.99999pt,16383.99999pt)},},
26 clip even odd rule/.code={\pgfseteorule}
27 }
28 \tikzset{use path now/.code={\pgfsyssoftpath@setcurrentpath#1}}
29
30 %----lengths
31 \newlength\tkzbrickfigheight
32 \newlength\tkzbrickfigheightlogo
33 \newlength\tkzbrickfigwidthlogo
34
35 %----keys
36 \defKV[tkzshapebrickfig]{%
37 color lines=\def\tkzshapebrickfiglinescolor{#1},%
38 color skin=\def\tkzshapebrickfigskincolor{#1},%
39 color sweat=\def\tkzshapebrickfigsweatcolor{#1},%
40 color pant=\def\tkzshapebrickfigpantcolor{#1},%
41 color belt=\tikzset{brickfig shape belt/.style={fill=#1}},
42 color bottom belt=\tikzset{brickfig shape bottom belt/.style={fill=#1}},
43 color body=\tikzset{brickfig shape body/.style={fill=#1}},
44 color arm=\tikzset{brickfig shape arm/.style={fill=#1}},
45 color arm shadow=\tikzset{brickfig shape arm shadow/.style={fill=#1}},
46 color hand=\tikzset{brickfig shape hand/.style={fill=#1}},
47 color hand shadow=\tikzset{brickfig shape hand shadow/.style={fill=#1}},
48 color neck=\tikzset{brickfig shape neck/.style={fill=#1}},
49 color head=\tikzset{brickfig shape head/.style={fill=#1}},
50 color hair=\tikzset{brickfig shape hair/.style={fill=#1}},
51 color top pant=\tikzset{brickfig shape top pant/.style={fill=#1}},
52 color middle pant=\tikzset{brickfig shape middle pant/.style={fill=#1}},
53 color foot=\tikzset{brickfig shape foot/.style={fill=#1}},%
54 logo=\def\tkzshapebrickfiglogo{#1},%
55 adjusted logo=\def\tkzshapebrickadjustlogo{#1},%
56 scale logo=\def\tkzshapebrickfigscalelogo{#1},%
57 figure name=\def\tkzshapebrickfigname{#1}
58 }
59 \setKVdefault[tkzshapebrickfig]{%
60 color lines={},%
61 color skin={},
62 color sweat={},%
63 color pant={},
64 color belt=darkgray,
65 color bottom belt=blue!75,
66 color body=red,
67 color arm=red,
68 color arm shadow=red!85!black,
69 color hand=yellow,
70 color hand shadow=yellow!85!black,
71 color neck=yellow,
72 color head=yellow,
73 color hair=brown,
74 color top pant=blue!75,
75 color middle pant=blue!75,
76 color foot=darkgray!50!black,%
77 display logo=false,%
78 custom logo=false,%
79 logo={},%
80 scale logo=0.667,
81 man=false,%
82 woman=false,%
83 empty=false,%
84 hairstyle=0,%
85 eyestyle=1,%
86 eyebrowstyle=1,%
87 mouthstyle=1,%
88 seed=365479,%
89 angry=false,%
90 scary=false,%
91 surprised=false,%
92 bbox=false,%
93 head=false,%
94 vcenter=false,%
95 figure name=MYBRICKFIG,%
96 adjusted logo={}
97 }
98
99 %----init styles
100 \tikzset{brickfig shape belt/.style={fill=gray}}
101 \tikzset{brickfig shape bottom belt/.style={fill=blue!75!black}}
102 \tikzset{brickfig shape body/.style={fill=red}}
103 \tikzset{brickfig shape arm/.style={fill=red}}
104 \tikzset{brickfig shape arm shadow/.style={fill=red!85!black}}
105 \tikzset{brickfig shape hand/.style={fill=yellow}}
106 \tikzset{brickfig shape hand shadow/.style={fill=yellow!85!black}}
107 \tikzset{brickfig shape neck/.style={fill=yellow}}
108 \tikzset{brickfig shape head/.style={fill=yellow}}
109 \tikzset{brickfig shape hair/.style={fill=brown}}
110 \tikzset{brickfig shape top pant/.style={fill=blue!75!black}}
111 \tikzset{brickfig shape middle pant/.style={fill=blue!75!black}}
112 \tikzset{brickfig shape foot/.style={fill=white}}
113
114 %----int eye
115 \newcommand\inttkzshapebrickfigeye[1]{%gen eye macro 1/2/3/4
116 \ifcase#1\relax%
117 \or\inttkzshapebrickfigeyeA{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHTSHADOW}{\tkzshapebrickfigname-EYELEFTSHADOW}%=1
118 \or\inttkzshapebrickfigeyeA{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHTSHADOWBOTTOM}{\tkzshapebrickfigname-EYELEFTSHADOWBOTTOM}%=2
119 \or\inttkzshapebrickfigeyeB{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHTSHADOWBOTTOM}{\tkzshapebrickfigname-EYELEFTSHADOWBOTTOM}%=3
120 \or\inttkzshapebrickfigeyeB{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}%=4
121 \or\inttkzshapebrickfigeyeC{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHTSHADOW}{\tkzshapebrickfigname-EYELEFTSHADOW}%=5
122 \or\inttkzshapebrickfigeyeD{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHTSHADOWBOTTOM}{\tkzshapebrickfigname-EYELEFTSHADOWBOTTOM}%=6
123 \or\inttkzshapebrickfigeyeE{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHTSHADOW}{\tkzshapebrickfigname-EYELEFT}%=7
124 \or\inttkzshapebrickfigeyeE[-1]{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHT}%=8
125 \or\inttkzshapebrickfigeyeC{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHTSHADOWBOTTOM}{\tkzshapebrickfigname-EYELEFTSHADOWBOTTOM}%=9
126 \or\inttkzshapebrickfigeyeD{\tkzshapebrickfigname-EYERIGHT}{\tkzshapebrickfigname-EYELEFT}{\tkzshapebrickfigname-EYERIGHTSHADOW}{\tkzshapebrickfigname-EYELEFTSHADOW}%=10
127 \fi%
128 }
129
130 \newcommand\inttkzshapebrickfigeyeA[4]{%normal eye
131 \fill[] (#1) circle[x radius=0.3,y radius=0.35] ;
132 \fill[] (#2) circle[x radius=0.3,y radius=0.35] ;
133 \fill[white] (#3) circle[x radius=0.1,y radius=0.125] ;
134 \fill[white] (#4) circle[x radius=0.1,y radius=0.125] ;
135 }
136
137 \newcommand\inttkzshapebrickfigeyeB[4]{%sad eye
138 \fill[] (#1) circle[x radius=0.3,y radius=0.35] ;
139 \fill[] (#2) circle[x radius=0.3,y radius=0.35] ;
140 \fill[white] (#3) circle[x radius=0.125,y radius=0.15] ;
141 \fill[white] (#4) circle[x radius=0.125,y radius=0.15] ;
142 }
143
144 \newcommand\inttkzshapebrickfigeyeC[4]{%
145 \fill[] (#1) circle[x radius=0.3,y radius=0.35] ;
146 \fill[] (#2) circle[x radius=0.3,y radius=0.35] ;
147 \fill[white] (#3) circle[x radius=0.1,y radius=0.125] ;
148 \fill[white] (#4) circle[x radius=0.1,y radius=0.125] ;
149 \draw[line cap=rect] ([shift={(0.575,-0.05)}]#1) to[bend left=15]++ (0.35,0) to[bend right=10] cycle ;
150 \draw[line cap=rect] ([shift={(0.575,-0.05)}]#1) to[bend left=15]++ (0.3,-0.3) to[bend right=10] cycle ;
151 \draw[line cap=rect] ([shift={(-0.575,-0.05)}]#2) to[bend right=15]++ (-0.35,0) to[bend left=10] cycle ;
152 \draw[line cap=rect] ([shift={(-0.575,-0.05)}]#2) to[bend right=15]++ (-0.3,-0.3) to[bend left=10] cycle ;
153 }
154
155 \newcommand\inttkzshapebrickfigeyeD[4]{%
156 \fill[] (#1) circle[x radius=0.3,y radius=0.35] ;
157 \fill[] (#2) circle[x radius=0.3,y radius=0.35] ;
158 \fill[white] (#3) circle[x radius=0.1,y radius=0.125] ;
159 \fill[white] (#4) circle[x radius=0.1,y radius=0.125] ;
160 \draw[line cap=round,line width=\fpeval{\tkzbrickfigscale*0.9}mm] ([shift={(-0.2,0.41)}]#1) to[bend right=10]++ (0.5,-0.15) ;
161 \draw[line cap=round,line width=\fpeval{\tkzbrickfigscale*0.9}mm] ([shift={(0.2,0.41)}]#2) to[bend left=10]++ (-0.5,-0.15) ;
162 }
163
164 \newcommand\inttkzshapebrickfigeyeE[5][1]{%
165 \begin{scope}[xscale=#1]
166 \filldraw[] ([shift={(-0.21,-0.2)}]#3) to[bend left=10]++ ({0.37},0) to[bend right=12.5]++ (0,0.4) to[bend right=10]++ (-0.37,0) to[bend right=12.5] cycle ;
167 \filldraw[] ([shift={(0.24,0.2)}]#3) to[bend right=10]++ (-0.56,0) -- cycle ;
168 \begin{scope}
169 \draw[,line width=\fpeval{\tkzbrickfigscale*0.9}mm] ([shift={(-0.30,-0.05)}]#2) to[out=35,in=155,looseness=1.5]++ (0.3,0) to[out=-25,in=-155,looseness=1]++ (0.3,0) ;
170 \end{scope}
171 \fill[white] (#5) circle[x radius=0.1,y radius=0.125] ;
172 \end{scope}
173 }
174
175 %----int eyebrow
176 \newcommand\inttkzshapebrickfigeyebrow[1]{%gen eyebrow macro 1/2/3/4/5/6/7/8
177 \ifcase#1\relax%
178 \or%=1
179 \inttkzshapebrickfigeyebrowB{\tkzshapebrickfigname-EYEBROWRIGHT}{\tkzshapebrickfigname-EYERIGHT}%
180 \inttkzshapebrickfigeyebrowB[-1]{\tkzshapebrickfigname-EYEBROWLEFT}{\tkzshapebrickfigname-EYELEFT}%
181 \or%=2
182 \inttkzshapebrickfigeyebrowA{\tkzshapebrickfigname-EYEBROWRIGHT}{\tkzshapebrickfigname-EYERIGHT}%
183 \inttkzshapebrickfigeyebrowA[-1]{\tkzshapebrickfigname-EYEBROWLEFT}{\tkzshapebrickfigname-EYELEFT}%
184 \or%=3
185 \inttkzshapebrickfigeyebrowC{\tkzshapebrickfigname-EYEBROWRIGHT}{\tkzshapebrickfigname-EYERIGHT}%
186 \inttkzshapebrickfigeyebrowC[-1]{\tkzshapebrickfigname-EYEBROWLEFT}{\tkzshapebrickfigname-EYELEFT}%
187 \or%=4
188 \inttkzshapebrickfigeyebrowD{\tkzshapebrickfigname-EYEBROWRIGHT}{\tkzshapebrickfigname-EYERIGHT}%
189 \inttkzshapebrickfigeyebrowD[-1]{\tkzshapebrickfigname-EYEBROWLEFT}{\tkzshapebrickfigname-EYELEFT}%
190 \or%=5
191 \inttkzshapebrickfigeyebrowE{\tkzshapebrickfigname-EYEBROWRIGHT}{\tkzshapebrickfigname-EYERIGHT}%
192 \inttkzshapebrickfigeyebrowE[-1]{\tkzshapebrickfigname-EYEBROWLEFT}{\tkzshapebrickfigname-EYELEFT}%
193 \or%=6
194 \inttkzshapebrickfigeyebrowF{\tkzshapebrickfigname-EYEBROWRIGHT}{\tkzshapebrickfigname-EYERIGHT}%
195 \inttkzshapebrickfigeyebrowF[-1]{\tkzshapebrickfigname-EYEBROWLEFT}{\tkzshapebrickfigname-EYELEFT}%
196 \or%=7
197 \inttkzshapebrickfigeyebrowG{\tkzshapebrickfigname-EYEBROWRIGHT}{\tkzshapebrickfigname-EYERIGHT}%
198 \inttkzshapebrickfigeyebrowG[-1]{\tkzshapebrickfigname-EYEBROWLEFT}{\tkzshapebrickfigname-EYELEFT}%
199 \or%=8
200 \inttkzshapebrickfigeyebrowH{\tkzshapebrickfigname-EYEBROWRIGHT}{\tkzshapebrickfigname-EYERIGHT}%
201 \inttkzshapebrickfigeyebrowH[-1]{\tkzshapebrickfigname-EYEBROWLEFT}{\tkzshapebrickfigname-EYELEFT}%
202 \or%=9
203 \inttkzshapebrickfigeyebrowI{\tkzshapebrickfigname-EYEBROWRIGHT}{\tkzshapebrickfigname-EYERIGHT}%
204 \inttkzshapebrickfigeyebrowI[-1]{\tkzshapebrickfigname-EYEBROWLEFT}{\tkzshapebrickfigname-EYELEFT}%
205 \or%=10
206 \inttkzshapebrickfigeyebrowJ{\tkzshapebrickfigname-EYEBROWRIGHT}{\tkzshapebrickfigname-EYERIGHT}%
207 \inttkzshapebrickfigeyebrowJ[-1]{\tkzshapebrickfigname-EYEBROWLEFT}{\tkzshapebrickfigname-EYELEFT}%
208 \fi%
209 }
210
211 \newcommand\inttkzshapebrickfigeyebrowA[3][1]{%woman eyebrow
212 \begin{scope}[shift={(#2)},xscale=#1]
213 \filldraw[,line width=\fpeval{\tkzbrickfigscale*0.3}mm] (-0.3,-0.2) to[bend left=45] (0.6,-0.05) to[bend right=25] cycle ;
214 \end{scope}
215 \begin{scope}[shift={(#3)},xscale=#1]
216 \draw[line width=\fpeval{\tkzbrickfigscale*0.8}mm] plot[smooth] coordinates{(-0.3,0.25) (0,0.35) (0.25,0.35) (0.6,0.45)} ;
217 \foreach \i in {0,2,4}{%
218 \draw[line width=\fpeval{\tkzbrickfigscale*0.6}mm] ({0.25+\i*(0.35)/4},{0.35+\i*(0.1)/4}) --++ (70:0.15) ;
219 }%
220 \end{scope}
221 }
222
223 \newcommand\inttkzshapebrickfigeyebrowB[2][1]{%man normal eyebrow
224 \begin{scope}[shift={(#2)},xscale=#1]
225 \filldraw[] (-0.3,-0.15) to[bend left=50] (0.5,-0.15) to[bend right=10] cycle ;
226 \end{scope}
227 }
228
229 \newcommand\inttkzshapebrickfigeyebrowC[2][1]{%man angry eyebrow
230 \begin{scope}[shift={(#2)},xscale=#1]
231 \filldraw[,line width=\fpeval{\tkzbrickfigscale*0.8}mm] plot[smooth] coordinates {(-0.3,-0.3) (0.3,0.15) (0.3,0.05)} -- cycle ;
232 \end{scope}
233 }
234
235 \newcommand\inttkzshapebrickfigeyebrowD[2][1]{%man scary eyebrow
236 \begin{scope}[shift={(#2)},xscale=#1]
237 \filldraw[] (-0.3,-0.05) to[bend left=50] (0.5,-0.3) to[bend right=10] cycle ;
238 \end{scope}
239 }
240
241 \newcommand\inttkzshapebrickfigeyebrowE[3][1]{%woman angry eyebrow
242 \begin{scope}[shift={(#2)},xscale=#1]
243 \filldraw[,line width=\fpeval{\tkzbrickfigscale*0.8}mm] plot[smooth] coordinates {(-0.3,-0.3) (0.4,0.1) (0.4,0.025)} -- cycle ;
244 \end{scope}
245 \begin{scope}[shift={(#3)},xscale=#1]%girly
246 \draw[line width=\fpeval{\tkzbrickfigscale*0.8}mm] plot[smooth] coordinates{(-0.3,0.25) (0,0.35) (0.25,0.35) (0.6,0.17)} ;
247 \foreach \i in {0,2,4}{%
248 \draw[line width=\fpeval{\tkzbrickfigscale*0.6}mm] ({0.25+\i*(0.35)/4},{0.35+\i*(0.17-0.35)/4}) --++ (70:0.15) ;
249 }%
250 \end{scope}
251 }
252
253 \newcommand\inttkzshapebrickfigeyebrowF[3][1]{%woman scary eyebrow
254 \begin{scope}[shift={(#2)},xscale=#1]
255 \filldraw[,line width=\fpeval{\tkzbrickfigscale*0.8}mm] plot[smooth] coordinates {(-0.3,-0.025) (0.5,-0.2) (0.4,-0.1)} -- cycle ;
256 \end{scope}
257 \begin{scope}[shift={(#3)},xscale=#1]%girly
258 \draw[,line width=\fpeval{\tkzbrickfigscale*0.8}mm] plot[smooth] coordinates{(-0.3,0.25) (0,0.35) (0.25,0.35) (0.6,0.17)} ;
259 \foreach \i in {0,2,4}{%
260 \draw[,line width=\fpeval{\tkzbrickfigscale*0.6}mm] ({0.25+\i*(0.35)/4},{0.35+\i*(0.17-0.35)/4}) --++ (70:0.15) ;
261 }%
262 \end{scope}
263 }
264
265 \newcommand\inttkzshapebrickfigeyebrowG[2][1]{%man surprised eyebrow
266 \begin{scope}[shift={(#2)},xscale=#1]
267 \filldraw[] (-0.3,-0.25) to[bend left=80,looseness=1.25] (0.5,-0.355) to[bend right=35,looseness=1.15] cycle ;
268 \end{scope}
269 }
270
271 \newcommand\inttkzshapebrickfigeyebrowH[3][1]{%woman surprised eyebrow
272 \begin{scope}[shift={(#2)},xscale=#1]
273 \filldraw[] (-0.3,-0.15) to[bend left=60,looseness=1.25] (0.6,-0.175) to[bend right=40,looseness=1.15] cycle ;
274 \end{scope}
275 \begin{scope}[shift={(#3)},xscale=#1]%girly
276 \draw[line width=\fpeval{\tkzbrickfigscale*0.8}mm] plot[smooth] coordinates{(-0.3,0.25) (0,0.35) (0.25,0.35) (0.6,0.325)} ;
277 \foreach \i in {0,2,4}{%
278 \draw[line width=\fpeval{\tkzbrickfigscale*0.6}mm] ({0.25+\i*(0.35)/4},{0.35+\i*(0.325-0.35)/4}) --++ (70:0.15) ;
279 }%
280 \end{scope}
281 }
282
283 \newcommand\inttkzshapebrickfigeyebrowI[2][1]{%man surprised eyebrow
284 \begin{scope}[shift={(#2)},xscale=#1]
285 \draw[line width=\fpeval{\tkzbrickfigscale*1.1}mm,] (-0.3,0) to[out=-45,in=180] (0.35,-0.25) to[out=0,in=100] (0.55,-0.4) ;
286 \end{scope}
287 }
288
289 \newcommand\inttkzshapebrickfigeyebrowJ[2][1]{%man surprised eyebrow
290 \begin{scope}[shift={(#2)},xscale=#1]
291 \filldraw[line width=\fpeval{\tkzbrickfigscale*1.1}mm,] (-0.3,-0.2) to[out=10,in=180]++ (0.65,0.2) to[out=0,in=100]++ (0.2,-0.175) to[out=100,in=0]++ (-0.2,0.15) to[out=180,in=5] cycle;
292 \end{scope}
293 }
294
295 %----int hair
296 \newcommand\inttikzshapehair[1]{%gen hair macro 1/2/3/4/5/6/7
297 \ifcase#1\relax{\draw[brickfig shape head] (-1,{5.45+3.385}) {[rounded corners=\fpeval{\tkzbrickfigscale*2}mm] --++ (0,0.7) --++ (2,0)} --++ (0,-0.7) -- cycle ;}%=0
298 \or{\draw[brickfig shape hair] (-1,{5.45+3.385}) {[rounded corners=\fpeval{\tkzbrickfigscale*2}mm] --++ (0,0.7) --++ (2,0)} --++ (0,-0.7) -- cycle ;}%=1
299 \or\inttkzshapebrickfighairstyleA{\tkzshapebrickfigname-HAIRCENTER}%=2
300 \or\inttkzshapebrickfighairstyleB{\tkzshapebrickfigname-HAIRCENTER}%=3
301 \or\inttkzshapebrickfighairstyleC{\tkzshapebrickfigname-HAIRCENTER}%=4
302 \or\inttkzshapebrickfighairstyleD{\tkzshapebrickfigname-HAIRCENTER}%=5
303 \or\inttkzshapebrickfighairstyleE{\tkzshapebrickfigname-HAIRCENTER}%=6
304 \or\inttkzshapebrickfighairstyleF{\tkzshapebrickfigname-HAIRCENTER}%=7
305 \or\inttkzshapebrickfighairstyleG{\tkzshapebrickfigname-HAIRCENTER}%=8
306 \or\inttkzshapebrickfighairstyleH{\tkzshapebrickfigname-HAIRCENTER}%=9
307 \or\inttkzshapebrickfighairstyleI{\tkzshapebrickfigname-HAIRCENTER}%=10
308 \fi%
309 }
310
311 \newcommand\inttkzshapebrickfighairstyleA[1]{%woman normal hair
312 \begin{scope}[shift={(#1)}]
313 \pgfmathsetseed{\useKV[tkzshapebrickfig]{seed}}%
314 \draw[brickfig shape hair,decoration={random steps,segment length=\fpeval{\tkzbrickfigscale*6}mm,amplitude=\fpeval{\tkzbrickfigscale*1.5}mm}] (-2.15,-1) to[out=-90,in=10,looseness=0.5] (-2.5,-2.75) to[out=0,in=-95] (-1.7,-1) decorate { -- (1.7,-1)} to[out=-85,in=180] (2.5,-2.75) to[out=170,in=-90,looseness=0.5] (2.15,-1.075) to[bend right=85,looseness=1.3] cycle ;
315 \draw[brickfig shape hair] (-0.2,0.2) to[bend right=5] (-0.4,-0.6) (0.2,0.2) to[bend left=5] (0.4,-0.6) ;
316 \draw[brickfig shape hair] (-0.6,0.15) to[bend right=5] (-1,-0.6) (0.6,0.15) to[bend left=5] (1,-0.6) ;
317 \draw[brickfig shape hair] (-1.2,0.05) to[bend right=5] (-1.7,-0.6) (1.2,0.05) to[bend left=5] (1.7,-0.6) ;
318 \end{scope}
319 }
320
321 \newcommand\inttkzshapebrickfighairstyleB[1]{%man normal hair
322 \begin{scope}[shift={(#1)}]
323 \pgfmathsetseed{\useKV[tkzshapebrickfig]{seed}}%
324 \draw[brickfig shape hair,decoration={random steps,segment length=\fpeval{\tkzbrickfigscale*6}mm,amplitude=\fpeval{\tkzbrickfigscale*1.5}mm}] (-2.15,-1) -- (-2.15,-2) -- (-1.8,-1) decorate {-- (1.8,-1)} -- (2.15,-2) -- (2.15,-1.125) to[bend right=85,looseness=1.3] cycle ;
325 \draw[brickfig shape hair] (-0.2,0.2) to[bend right=5] (-0.4,-0.6) (0.2,0.2) to[bend left=5] (0.4,-0.6) ;
326 \draw[brickfig shape hair] (-0.6,0.15) to[bend right=5] (-1,-0.6) (0.6,0.15) to[bend left=5] (1,-0.6) ;
327 \draw[brickfig shape hair] (-1.2,0.05) to[bend right=5] (-1.7,-0.6) (1.2,0.05) to[bend left=5] (1.7,-0.6) ;
328 \end{scope}
329 }
330
331 \newcommand\inttkzshapebrickfighairstyleC[1]{%man 'brosse' hair
332 \begin{scope}[shift={(#1)}]
333 \draw[brickfig shape hair] (-2.025,-1.65) {[rounded corners=\fpeval{\tkzbrickfigscale*0.5}mm] -- (-1.7,-0.8) to[out=-15,in=165,looseness=0.5] (1.7,-0.8) -- (2.025,-1.685) to[bend right=10] (2.025,0.5) -- (1.75,0.05) -- (1.4,0.55) -- (1.05,0) -- (0.7,0.45) -- (0.35,-0.025) -- (0,0.475) -- (-0.35,0.1) -- (-0.7,0.525) -- (-1.05,-0.1) -- (-1.4,0.475) -- (-1.75,0) -- (-2.025,0.515)} to[bend right=10] cycle ;
334 \draw[brickfig shape hair] (0,-0.5) -- (0,-0.1)
335 (0.5,-0.5) -- (0.51,-0.1)
336 (1,-0.5) -- (1.1,-0.1)
337 (1.5,-0.5) -- (1.6,-0.1)
338 (1.9,-0.5) -- (2,-0.1)
339 (-0.5,-0.5) -- (-0.51,-0.1)
340 (-1,-0.5) -- (-1.1,-0.15)
341 (-1.5,-0.5) -- (-1.6,-0.1)
342 (-1.9,-0.5) -- (-2,-0.1) ;
343 \end{scope}
344 }
345
346 \newcommand\inttkzshapebrickfighairstyleD[1]{%woman alt hair
347 \begin{scope}[shift={(#1)}]
348 \draw[brickfig shape hair] (-0.25,0) to[bend left=75,looseness=1.5] (2.15,0) to[bend right=15,looseness=1.5] (2.6,-0.25) to[bend left=20,looseness=1.2] ++(-0.45,0) to[bend right=10] ++(0.5,-0.85) to[bend left=5] ++(-0.35,0.15) to[bend right=30] ++(0.55,-1.25) to[bend left=15] (2,-1.5) to[bend right=70,looseness=1.25] (0,0.15) -- cycle ;
349 \draw[brickfig shape hair] (0,-0.5) to[bend left=70,looseness=0.75] (2,-1.5) to[bend right=70,looseness=1.25] (0,0.15) to[bend right=70,looseness=1.25] (-2,-1.5) to[bend left=70,looseness=0.75] cycle ;
350 \draw[brickfig shape hair] (0,-0.315) -- (0,0)
351 (0.85,-0.3) -- (1,-0.05)
352 (1.65,-0.7) -- (1.8,-0.3)
353 (-0.85,-0.3) -- (-1,-0.05)
354 (-1.65,-0.7) -- (-1.8,-0.3) ;
355 \end{scope}
356 }
357
358 \newcommand\inttkzshapebrickfighairstyleE[1]{%man brushing hair
359 \begin{scope}[shift={(#1)}]
360 \draw[brickfig shape hair,smooth] (0.66,0.44) to[out=30,in=120] (2.2,-0.3) to[bend left] (2,-2) -- (2,-1.35) to[bend left=5] (0.66,-0.4) to[bend left=7.5] (-2,-1.4) -- (-2,-2.15) to[bend left=70,looseness=1.4] (0.66,0.44) -- (0.66,-0.4);
361 \draw[brickfig shape hair] (1.1,0) to[bend right=5] (1.87,-0.9)
362 (0,0) to[bend left=10] (-1.8,-0.85)
363 (-0.5,0.4) to[bend right=7.5] (-1.56,-0.3) ;
364 \end{scope}
365 }
366
367 \newcommand\inttkzshapebrickfighairstyleF[1]{%woman 'natte' brushing hair
368 \begin{scope}[shift={(#1)}]
369 \draw[brickfig shape hair,smooth] (0.66,0.44) to[out=30,in=120] (2.2,-0.3) to[bend left] (2,-2) -- (2,-1.35) to[bend left=5] (0.66,-0.4) to[bend left=7.5] (-2,-1.4) -- (-2,-2.15) to[bend left=70,looseness=1.4] (0.66,0.44) -- (0.66,-0.4);
370 \draw[brickfig shape hair] (1.1,0) to[bend right=5] (1.87,-0.9)
371 (0,0) to[bend left=10] (-1.8,-0.85)
372 (-0.5,0.4) to[bend right=7.5] (-1.56,-0.3) ;
373 \draw[brickfig shape hair] (-2,-2.15) to[bend right=30] (-2.44,-2.65) to[bend right=30] (-2.88,-3.2) to[bend right=40] (-3.12,-3.6) -- (-2.85,-3.8) to[bend right=40] (-2.58,-3.4) to[bend right=30] (-2.14,-2.85) to[bend right=30] (-2,-2.5) -- cycle ;
374 \draw[brickfig shape hair] (-2.88,-3.2) -- (-2.58,-3.4) (-2.44,-2.65) to[out=-75,in=92.5] (-2.58,-3.4) (-2.14,-2.85) to[out=-170,in=62.5] (-2.88,-3.2) (-2.44,-2.65) -- (-2.14,-2.85) (-2,-2.15) to[out=-140,in=92.5] (-2.14,-2.85) (-2.44,-2.65) to[out=30,in=-160] (-2,-2.35) ;
375 \end{scope}
376 }
377
378 \newcommand\inttkzshapebrickfighairstyleG[1]{%woman long hair
379 \begin{scope}[shift={(#1)}]
380 \draw[brickfig shape hair] (1.35,-3.96) -- (2.3,-3.96) -- (2.3,-1) to[out=100,in=25] (0,0.3) to [out=155,in=80] (-2.3,-1) -- (-2.3,-3.96) -- (-1.35,-3.96) -- (-1.35,-3.735) {[rounded corners=\fpeval{\tkzbrickfigscale*8}mm] -- (-2,-3.735)} -- (-2,-1) to[out=5,in=-175] (2,-1) {[rounded corners=\fpeval{\tkzbrickfigscale*8}mm] -- (2,-3.735)} -- (1.35,-3.735) -- (1.35,-3.96);
381 %franges
382 \draw[brickfig shape hair] (-2,-1) to[bend left=10] ++ (60:1) (2,-1) to[bend right=10] ++ (120:1)
383 (-1.4,-0.9) to[bend left=10] ++ (70:0.9) (1.4,-0.9) to[bend right=10] ++ (110:0.9)
384 (-0.7,-0.9) to[bend left=10] ++ (80:0.9) (0.7,-0.9) to[bend right=10] ++ (100:0.9)
385 (0,-0.9) --++ (0,0.8) ;
386 \draw[brickfig shape hair] (-1.9,-3.96) --++ (0,0.3) (1.9,-3.96) --++ (0,0.3)
387 (-2.1,-3.96) --++ (0,0.5) (2.1,-3.96) --++ (0,0.5)
388 (-2.3,-3.96) --++ (0,0.7) (2.3,-3.96) --++ (0,0.7) ;
389 \end{scope}
390 }
391
392 \newcommand\inttkzshapebrickfighairstyleH[1]{%neutral hair %%[out=15,in=80] (2.1,-1) to[bend left=5]
393 \begin{scope}[shift={(#1)}]
394 \draw[brickfig shape hair] (0,0.3) to[bend left=60,looseness=1.25] (2.05,-1.85) to[bend left=5] (1.05,-0.65) -- (1.05,-1.1) to[bend left=5] (0.1,-0.68) -- (0.3,-1.175) to[bend left=25] (-0.75,-0.6) to[bend left=5] (-2.05,-1.85) to[bend left=60,looseness=1.25] cycle ;
395 \draw[brickfig shape hair] (1.05,-0.65) to[bend left=5]++ (-0.35,0.6)
396 (0.1,-0.68) to[bend left=5] (-0.1,0.1)
397 (-0.75,-0.6) to[bend left=10] (-0.5,0.125)
398 (-1.75,-0.75) to[bend left=15]++ (0.75,0.675) ;
399 \end{scope}
400 }
401
402 \newcommand\inttkzshapebrickfighairstyleI[1]{%neutral hair %%[out=15,in=80] (2.1,-1) to[bend left=5]
403 \begin{scope}[shift={(#1)}]
404 \draw[brickfig shape hair] (0,0.3) to[bend left=40,looseness=1.5] (0.45,0.3) to[bend left=50,looseness=1.35] (2.05,-1.85) to[bend left=10] (0.85,-0.6) to[bend right=10]++ (0.05,-0.5) to[bend left=10]++ (-0.75,0.5) to[bend right=10]++ (-0.35,-0.5) to[bend left=10]++ (-0.875,0.5) to[bend left=10] (-2.05,-1.85) to[bend left=50,looseness=1.35] (-0.45,0.3) to[bend left=40,looseness=1.5] cycle;%
405 \draw[brickfig shape hair] (1.2,0) to[bend left=10]++ (0.45,-0.5)
406 (0.1,0.05) to[bend right=7.5] (0.3,-0.4)
407 (-0.52,0.04) to[bend right=10]++ (0.4,-0.425)
408 (-1.75,-0.75) to[bend left=15]++ (0.75,0.675) ;
409 \end{scope}
410 }
411
412 %----int mouth
413 \newcommand\inttkzshapebrickfigmouth[1]{%gen mouth macro 1/2/3/4
414 \ifcase#1\relax%
415 \or\inttkzshapebrickfigmouthA{\tkzshapebrickfigname-MOUTH}%=1
416 \or\inttkzshapebrickfigmouthB{\tkzshapebrickfigname-MOUTH}%=2
417 \or\inttkzshapebrickfigmouthC{\tkzshapebrickfigname-MOUTH}%=3
418 \or\inttkzshapebrickfigmouthD{\tkzshapebrickfigname-MOUTH}%=4
419 \or\inttkzshapebrickfigmouthE{\tkzshapebrickfigname-MOUTH}%=5
420 \or\inttkzshapebrickfigmouthF{\tkzshapebrickfigname-MOUTH}%=6
421 \or\inttkzshapebrickfigmouthG{\tkzshapebrickfigname-MOUTH}%=7
422 \or\inttkzshapebrickfigmouthH{\tkzshapebrickfigname-MOUTH}%=8
423 \or\inttkzshapebrickfigmouthE[-1]{\tkzshapebrickfigname-MOUTH}%=9
424 \or\inttkzshapebrickfigmouthG[-1]{\tkzshapebrickfigname-MOUTH}%=10
425 \fi%
426 }
427
428 \newcommand\inttkzshapebrickfigmouthA[1]{%happy mouth
429 \begin{scope}[shift={(#1)}]
430 \filldraw[] (-0.625,0.15) to[bend right=70] (0.625,0.15) to[bend left=20] cycle ;
431 \end{scope}
432 }
433
434 \newcommand\inttkzshapebrickfigmouthB[1]{%angry mouth
435 \begin{scope}[shift={(#1)}]
436 \draw[fill=white,line width=\fpeval{\tkzbrickfigscale*0.8}mm] plot[smooth] coordinates{(-0.625,-0.1) (0.625,-0.1) (0.625,0.25) (-0.625,0.05)} {[rounded corners=\fpeval{\tkzbrickfigscale*0.2}mm]-- cycle} ;
437 \clip plot[smooth] coordinates{(-0.625,-0.1) (0.625,-0.1) (0.625,0.25) (-0.625,0.05)} {[rounded corners=\fpeval{\tkzbrickfigscale*0.2}mm]-- cycle} ;
438 \filldraw[line width=\fpeval{\tkzbrickfigscale*0.5}mm] (0.45,0.045) -- (0.75,0.1) -- (0.75,0.075) --cycle;
439 \end{scope}
440 }
441
442 \newcommand\inttkzshapebrickfigmouthC[1]{%scary mouth
443 \begin{scope}[shift={(#1)}]
444 \draw[fill=white,line width=\fpeval{\tkzbrickfigscale*0.8}mm] plot[smooth] coordinates{(0,0.15) (0.625,0.225) (0.625,-0.275) (0,-0.15) (-0.6,-0.275) (-0.6,0.225) (0,0.15)} ;
445 \end{scope}
446 }
447
448 \newcommand\inttkzshapebrickfigmouthD[1]{%surprised mouth
449 \begin{scope}[shift={(#1)}]
450 \draw[fill=white,line width=\fpeval{\tkzbrickfigscale*1.2}mm] circle[x radius=0.325,y radius=0.375] ; ;
451 \end{scope}
452 }
453
454 \newcommand\inttkzshapebrickfigmouthE[2][1]{%enjoyed mouth
455 \begin{scope}[shift={(#2)},xscale=#1]
456 \filldraw[] (-0.8,0.45) to[bend right=20] (0.8,0.075) to[bend left=80,looseness=1.375] cycle ;
457 \begin{scope}[rotate=-20]
458 \filldraw[red!75!black,rounded corners=\fpeval{\tkzbrickfigscale*0.2}mm] (-0.15,-0.2) circle[x radius=0.375,y radius=0.115] ;
459 \end{scope}
460 \end{scope}
461 }
462
463 \newcommand\inttkzshapebrickfigmouthF[1]{%girly mouth
464 \begin{scope}[shift={(#1)}]
465 \fill[red!75!black,opacity=0.66] (-0.5,0.175) to[bend left=30] (0,0.075) to[bend left=30] (0.5,0.175) to[bend left=40] cycle ;
466 \fill[red!75!black,opacity=0.66] (-0.5,0) to[bend right=50] (0.5,0.0) -- cycle ;
467 \filldraw[] (-0.65,0.25) to[bend right=70] (0.65,0.25) to[bend left=45] cycle ;
468 \end{scope}
469 }
470
471 \newcommand\inttkzshapebrickfigmouthG[2][1]{%angry mouth
472 \begin{scope}[shift={(#2)},xscale=#1]
473 \draw[fill=white,line width=\fpeval{\tkzbrickfigscale*0.8}mm] (-0.66,0.2) to[out=-45,in=-170] (0.66,0) to[bend left=80,looseness=1.5] cycle ;
474 \draw[line width=\fpeval{\tkzbrickfigscale*0.8}mm] (-0.66,0.2) to[bend left=5] ++ (0.1,0.15) ;
475 \draw[line width=\fpeval{\tkzbrickfigscale*0.8}mm] (-0.66,0.2) to[bend right=5] ++ (-0.1,-0.2) ;
476 \clip (-0.66,0.2) to[out=-45,in=-170] (0.66,0) to[bend left=80,looseness=1.5] cycle ;
477 \draw[line join=rect] (-0.66,-0.1) -- (-0.325,-0.2) to[bend left=15] cycle ;
478 \end{scope}
479 }
480
481 \newcommand\inttkzshapebrickfigmouthH[1]{%happy mouth
482 \begin{scope}[shift={(#1)}]
483 \filldraw[] (-0.625,-0.15) to[bend left=70] (0.625,-0.15) to[bend right=20] cycle ;
484 \end{scope}
485 }
486
487 %----individual part
488 \newcommand\inttkzshapebrickfigbody{%
489 \draw[brickfig shape body] (-3,0) -- (3,0) -- (3,0.6) {[rounded corners=\fpeval{\tkzbrickfigscale*4}mm] -- (2.25,5) -- (-2.25,5)} -- (-3,0.6) -- (-3,0) -- cycle ;
490 }
491 \newcommand\inttkzshapebrickfigneck{%
492 \draw[brickfig shape neck] (-1.35,5) rectangle (1.35,5.45) ;
493 }
494 \newcommand\inttkzshapebrickfighead{%
495 \draw[brickfig shape head,rounded corners=\fpeval{\tkzbrickfigscale*8}mm] (-2,5.45) rectangle (2,{5.45+3.385}) ;
496 }
497 \newcommand\inttkzshapebrickfigleftarmscratch{%
498 \draw[brickfig shape arm] (2.35,4.4) --++ (-170:0.3) --++ (100:0.075) to[bend right=95,looseness=1.5] ++ (-80:1.1) --++ (100:0.075) --++ (10:0.3) -- cycle ;
499 }
500 \newcommand\inttkzshapebrickfigleftarm{%
501 \draw[brickfig shape arm] (2.3175,4.6) {[rounded corners=\fpeval{\tkzbrickfigscale*6}mm] -- (3,4.6) -- (4.2,2.6)} -- (4.6,0.75) to[bend right=30] (3,0.5) -- cycle ;
502 \begin{scope}
503 \path[save path=\pathbrickfigtikzarm] (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=110,looseness=3] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) to[bend right=20] (3.34,0.5375) ;
504 \clip[use path now=\pathbrickfigtikzarm,invclip];
505 \draw[brickfig shape arm,brickfig shape arm shadow] (4.6,0.75) to[bend right=30] (3,0.5) to[bend right=30] (4.6,0.75) ;
506 \end{scope}
507 \draw[brickfig shape hand shadow] (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=90,looseness=2] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) to[bend right=20] (3.34,0.5375) ;
508 \draw[brickfig shape hand] (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=110,looseness=3] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) to[bend right=20] (3.34,0.5375) ;
509 }
510 \newcommand\inttkzshapebrickfigleftarmwohand{%
511 \draw[brickfig shape arm] (2.35,4.4) --++ (-170:0.3) --++ (100:0.075) to[bend right=95,looseness=1.5] ++ (-80:1.1) --++ (100:0.075) --++ (10:0.3) -- cycle ;
512 \draw[brickfig shape arm] (2.3175,4.6) {[rounded corners=\fpeval{\tkzbrickfigscale*6}mm] -- (3,4.6) -- (4.2,2.6)} -- (4.6,0.75) to[bend right=30] (3,0.5) -- cycle ;
513 \draw[brickfig shape arm,brickfig shape arm shadow] (4.6,0.75) to[bend right=30] (3,0.5) to[bend right=30] (4.6,0.75) ;
514 }
515 \newcommand\inttkzshapebrickfiglefthand{%
516 \begin{scope}
517 \path (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=90,looseness=2] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) coordinate[at end] (tmpzzzzzzzz);
518 \draw[brickfig shape hand] ($(3.34,0.5375)!0.2!(tmpzzzzzzzz)$) --++ (100:1.65) to[bend left=20]++ (8:0.6) --++ (-81:1.65) -- cycle ;
519 \draw[brickfig shape hand shadow] (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=90,looseness=2] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) to[bend right=20] (3.34,0.5375) ;
520 \draw[brickfig shape hand] (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=110,looseness=3] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) to[bend right=20] (3.34,0.5375) ;
521 \end{scope}
522 }
523 \newcommand\inttkzshapebrickfigrighthand{%
524 \begin{scope}[xscale=-1]
525 \path (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=90,looseness=2] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) coordinate[at end] (tmpzzzzzzzz);
526 \draw[brickfig shape hand] ($(3.34,0.5375)!0.2!(tmpzzzzzzzz)$) --++ (100:1.65) to[bend left=20]++ (8:0.6) --++ (-81:1.65) -- cycle ;
527 \draw[brickfig shape hand shadow] (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=90,looseness=2] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) to[bend right=20] (3.34,0.5375) ;
528 \draw[brickfig shape hand] (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=110,looseness=3] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) to[bend right=20] (3.34,0.5375) ;
529 \end{scope}
530 }
531 \newcommand\inttkzshapebrickfigrightarmwohand{%
532 \begin{scope}[xscale=-1]
533 \draw[brickfig shape arm] (2.35,4.4) --++ (-170:0.3) --++ (100:0.075) to[bend right=95,looseness=1.5] ++ (-80:1.1) --++ (100:0.075) --++ (10:0.3) -- cycle ;
534 \draw[brickfig shape arm] (2.3175,4.6) {[rounded corners=\fpeval{\tkzbrickfigscale*6}mm] -- (3,4.6) -- (4.2,2.6)} -- (4.6,0.75) to[bend right=30] (3,0.5) -- cycle ;
535 \draw[brickfig shape arm,brickfig shape arm shadow] (4.6,0.75) to[bend right=30] (3,0.5) to[bend right=30] (4.6,0.75) ;
536 \end{scope}
537 }
538 \newcommand\inttkzshapebrickfigrightarmscratch{%
539 \begin{scope}[xscale=-1]
540 \draw[brickfig shape arm] (2.35,4.4) --++ (-170:0.3) --++ (100:0.075) to[bend right=95,looseness=1.5] ++ (-80:1.1) --++ (100:0.075) --++ (10:0.3) -- cycle ;
541 \end{scope}
542 }
543 \newcommand\inttkzshapebrickfigrightarm{%
544 \begin{scope}[xscale=-1]
545 \draw[brickfig shape arm] (2.3175,4.6) {[rounded corners=\fpeval{\tkzbrickfigscale*6}mm] -- (3,4.6) -- (4.2,2.6)} -- (4.6,0.75) to[bend right=30] (3,0.5) -- cycle ;
546 \begin{scope}
547 \path[save path=\pathbrickfigtikzarm] (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=110,looseness=3] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) to[bend right=20] (3.34,0.5375) ;
548 \clip[use path now=\pathbrickfigtikzarm,invclip];
549 \draw[brickfig shape arm,brickfig shape arm shadow] (4.6,0.75) to[bend right=30] (3,0.5) to[bend right=30] (4.6,0.75) ;
550 \end{scope}
551 \draw[brickfig shape hand shadow] (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=90,looseness=2] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) to[bend right=20] (3.34,0.5375) ;
552 \draw[brickfig shape hand] (3.34,0.5375) --++(-80:0.5) to[bend right=60] ++ (-80:1.8) --++ (100:0.5) to[bend left=110,looseness=3] ++ (10:1) --++ (-80:0.5) to[bend right=60] ++ (100:1.8) --++ (100:0.45) to[bend right=20] (3.34,0.5375) ;
553 \end{scope}
554 }
555 \newcommand\inttkzshapebrickfigarms{%
556 \inttkzshapebrickfigleftarm
557 \inttkzshapebrickfigrightarm
558 }
559 \newcommand\inttkzshapebrickfigpant{%
560 %belt
561 \draw[brickfig shape belt] (-2.75,0) rectangle (2.75,-0.8) ;
562 \draw[brickfig shape bottom belt] (-0.25,-0.8) -- (-0.25,-3.1) -- (-0.1,-3.3) -- (0.1,-3.3) -- (0.25,-3.1) -- (0.25,-0.8) -- cycle ;
563 %leg 1
564 \draw[brickfig shape middle pant] (-2.75,-3) --++ (0,-3.3) --++ (2.65,0) --++ (0,3) -- (-0.25,-3.1) --++ (0,0.15) |- (-2.75,-0.8) -- cycle ;
565 \draw[brickfig shape top pant] (-2.75,-0.8) rectangle (-0.25,-3) ;
566 \draw[brickfig shape foot] (-2.75,-5.1) rectangle (-0.1,-6.3) ;
567 %leg 2
568 \begin{scope}[xscale=-1]
569 \draw[brickfig shape middle pant] (-2.75,-3) --++ (0,-3.3) --++ (2.65,0) --++ (0,3) -- (-0.25,-3.1) --++ (0,0.15) |- (-2.75,-0.8) -- cycle ;
570 \draw[brickfig shape top pant] (-2.75,-0.8) rectangle (-0.25,-3) ;
571 \draw[brickfig shape foot] (-2.75,-5.1) rectangle (-0.1,-6.3) ;
572 \end{scope}
573 }
574 \newcommand\inttkzshapebrickfignodes{%
575 \coordinate (\tkzshapebrickfigname-EYERIGHT) at (0.6,7.38) ;
576 \coordinate (\tkzshapebrickfigname-EYERIGHTSHADOW) at (0.6,7.5) ;
577 \coordinate (\tkzshapebrickfigname-EYERIGHTSHADOWBOTTOM) at (0.6,7.26) ;
578 \coordinate (\tkzshapebrickfigname-EYELEFT) at (-0.6,7.38) ;
579 \coordinate (\tkzshapebrickfigname-EYES) at (0,7.38) ;
580 \coordinate (\tkzshapebrickfigname-EYELEFTSHADOW) at (-0.6,7.5) ;
581 \coordinate (\tkzshapebrickfigname-EYELEFTSHADOWBOTTOM) at (-0.6,7.26) ;
582 \coordinate (\tkzshapebrickfigname-MOUTH) at (0,6.4) ;
583 \coordinate (\tkzshapebrickfigname-EYEBROWRIGHT) at (0.6,8.1) ;
584 \coordinate (\tkzshapebrickfigname-EYEBROWS) at (0,8.1) ;
585 \coordinate (\tkzshapebrickfigname-EYEBROWLEFT) at (-0.6,8.1) ;
586 \coordinate (\tkzshapebrickfigname-LOGO) at (0,2.5) ;
587 \coordinate (\tkzshapebrickfigname-HAIRCENTER) at (0,{5.45+3.385+0.5*0.7}) ;
588 \coordinate (\tkzshapebrickfigname-HAIR) at (0,{5.45+3.385+0.5*0.7}) ;
589 \coordinate (\tkzshapebrickfigname-LEFTHAND) at (4.15,-1.25) ;
590 \coordinate (\tkzshapebrickfigname-RIGHTHAND) at (-4.15,-1.25) ;
591 \coordinate (\tkzshapebrickfigname-RIGHTFOOT) at (-1.425,-5.7) ;
592 \coordinate (\tkzshapebrickfigname-LEFTFOOT) at (1.425,-5.7) ;
593 \coordinate (\tkzshapebrickfigname-BELT) at (0,-0.4) ;
594 \coordinate (\tkzshapebrickfigname-RIGHTSHOULDER) at (-2.75,4.5) ;
595 \coordinate (\tkzshapebrickfigname-LEFTSHOULDER) at (2.75,4.5) ;
596 \coordinate (\tkzshapebrickfigname-NECK) at (0,5.225) ;
597 }
598 %----internal macro adjustedlogo
599 \newsavebox\tmpboxlogotofith
600 \newsavebox\tmpboxlogotofitv
601 \newlength\tmpwidthlogotofitv
602
603 \newcommand\adjustlogotosweat[1]{%
604 \savebox{\tmpboxlogotofitv}{\resizebox*{!}{\fpeval{1/\tkzbrickfigscale}\tkzbrickfigheightlogo}{#1}}%v-stretch
605 \savebox{\tmpboxlogotofith}{\resizebox*{\fpeval{1/\tkzbrickfigscale}\tkzbrickfigwidthlogo}{!}{#1}}%h-stretch
606 \settowidth\tmpwidthlogotofitv{\usebox{\tmpboxlogotofitv}}%
607 \ifthenelse{\tmpwidthlogotofitv < \tkzbrickfigwidthlogo}%
608 {%width ok
609 {\usebox{\tmpboxlogotofitv}}%
610 }%
611 {%width ko => h-stretch
612 {\usebox{\tmpboxlogotofith}}%
613 }%
614 }
615
616 %----main macro
617 \NewDocumentCommand\tikzbrickfigurine{O{}D<>{}m}{%
618 \restoreKV[tkzshapebrickfig]%
619 \setKV[tkzshapebrickfig]{#1}%
620 %----bbox if needed (compil increase time...)
621 \ifboolKV[tkzshapebrickfig]{bbox}%
622 {\tikzset{brickfig shape bbox/.style={bezier bounding box=true}}}%
623 {\tikzset{brickfig shape bbox/.style={bezier bounding box=false}}}%
624 \ifboolKV[tkzshapebrickfig]{vcenter}%
625 {\tikzset{brickfig shape vcenter/.style={baseline=(current bounding box.center)}}}%
626 {\tikzset{brickfig shape vcenter/.style={}}}%
627 %----colors shortcuts if necessary
628 \IfStrEq{\tkzshapebrickfigskincolor}{}{}%
629 {%
630 \tikzset{brickfig shape hand/.style={fill=\tkzshapebrickfigskincolor}}%
631 \tikzset{brickfig shape hand shadow/.style={fill=\tkzshapebrickfigskincolor!85!black}}%
632 \tikzset{brickfig shape neck/.style={fill=\tkzshapebrickfigskincolor}}%
633 \tikzset{brickfig shape head/.style={fill=\tkzshapebrickfigskincolor}}%
634 }%
635 \IfStrEq{\tkzshapebrickfigsweatcolor}{}{}%
636 {%
637 \tikzset{brickfig shape body/.style={fill=\tkzshapebrickfigsweatcolor}}%
638 \tikzset{brickfig shape arm/.style={fill=\tkzshapebrickfigsweatcolor}}%
639 \tikzset{brickfig shape arm shadow/.style={fill=\tkzshapebrickfigsweatcolor!85!black}}%
640 }%
641 \IfStrEq{\tkzshapebrickfigpantcolor}{}{}%
642 {%
643 \tikzset{brickfig shape belt/.style={fill=\tkzshapebrickfigpantcolor}}%
644 \tikzset{brickfig shape bottom belt/.style={fill=\tkzshapebrickfigpantcolor}}%
645 \tikzset{brickfig shape top pant/.style={fill=\tkzshapebrickfigpantcolor}}%
646 \tikzset{brickfig shape middle pant/.style={fill=\tkzshapebrickfigpantcolor}}%
647 }%
648 \ifboolKV[tkzshapebrickfig]{empty}%
649 {%
650 \tikzset{brickfig shape belt/.style={}}%
651 \tikzset{brickfig shape bottom belt/.style={}}%
652 \tikzset{brickfig shape body/.style={}}%
653 \tikzset{brickfig shape arm/.style={}}%
654 \tikzset{brickfig shape arm shadow/.style={}}%
655 \tikzset{brickfig shape hand/.style={}}%
656 \tikzset{brickfig shape hand shadow/.style={}}%
657 \tikzset{brickfig shape neck/.style={}}%
658 \tikzset{brickfig shape head/.style={}}%
659 \tikzset{brickfig shape hair/.style={}}%
660 \tikzset{brickfig shape top pant/.style={}}%
661 \tikzset{brickfig shape middle pant/.style={}}%
662 \tikzset{brickfig shape foot/.style={}}%
663 }%
664 {}%
665 %----adjusted logo
666 \ifdefempty{\tkzshapebrickadjustlogo}%
667 {}%
668 {\setKV[tkzshapebrickfig]{display logo=false,custom logo=false}}%
669 %----prefefined styles (??)
670 \ifboolKV[tkzshapebrickfig]{man}%
671 {%
672 \setKV[tkzshapebrickfig]{eyebrowstyle=1}%default man
673 \ifboolKV[tkzshapebrickfig]{angry}{\setKV[tkzshapebrickfig]{mouthstyle=2,eyebrowstyle=3}}{}%
674 \ifboolKV[tkzshapebrickfig]{scary}{\setKV[tkzshapebrickfig]{mouthstyle=3,eyestyle=2,eyebrowstyle=4}}{}%
675 \ifboolKV[tkzshapebrickfig]{surprised}{\setKV[tkzshapebrickfig]{mouthstyle=4,eyestyle=3,eyebrowstyle=7}}{}%
676 }%
677 {}%
678 \ifboolKV[tkzshapebrickfig]{woman}%
679 {%
680 \setKV[tkzshapebrickfig]{eyebrowstyle=2}%default woman%
681 \ifboolKV[tkzshapebrickfig]{angry}{\setKV[tkzshapebrickfig]{mouthstyle=2,eyebrowstyle=5}}{}%
682 \ifboolKV[tkzshapebrickfig]{scary}{\setKV[tkzshapebrickfig]{mouthstyle=3,eyestyle=2,eyebrowstyle=6}}{}%
683 \ifboolKV[tkzshapebrickfig]{surprised}{\setKV[tkzshapebrickfig]{mouthstyle=4,eyestyle=3,eyebrowstyle=8}}{}%
684 }%
685 {}%
686 %----lengths
687 \setlength\tkzbrickfigheight{#3}%
688 \xdef\tkzbrickfigscale{\fpeval{\tkzbrickfigheight/16cm}}%
689 \setlength\tkzbrickfigheightlogo{\fpeval{\tkzshapebrickfigscalelogo*5/16}\tkzbrickfigheight}%
690 \setlength\tkzbrickfigwidthlogo{\fpeval{\tkzshapebrickfigscalelogo*4.5/16}\tkzbrickfigheight}%
691 %----picture
692 \begin{tikzpicture}[\tkzshapebrickfiglinescolor,scale=\tkzbrickfigscale,line width=\fpeval{\tkzbrickfigscale*0.8}mm,line join=round,line cap=round,#2,brickfig shape bbox,brickfig shape vcenter,transform shape]
693 %----body / neck / head / legs / arms
694 \inttkzshapebrickfigbody
695 \inttkzshapebrickfigneck
696 \inttkzshapebrickfighead
697 \inttkzshapebrickfigpant
698 \inttkzshapebrickfigarms
699 %----nodes
700 \inttkzshapebrickfignodes
701 %-----decorations
702 \ifboolKV[tkzshapebrickfig]{empty}{}%
703 {%
704 %----simple eye + simple mouth + eyebrow + hairstyle
705 \inttkzshapebrickfigeye{\useKV[tkzshapebrickfig]{eyestyle}}
706 \inttkzshapebrickfigmouth{\useKV[tkzshapebrickfig]{mouthstyle}}
707 \inttkzshapebrickfigeyebrow{\useKV[tkzshapebrickfig]{eyebrowstyle}}
708 \inttikzshapehair{\useKV[tkzshapebrickfig]{hairstyle}}
709 }%
710 %logo (auto or custom)
711 \begin{scope}
712 \clip (-2.25,0) rectangle (2.25,5) ;
713 \ifboolKV[tkzshapebrickfig]{display logo}%with cancel scale
714 {\node[inner sep=0pt,scale=\fpeval{1/(\tkzbrickfigscale)}] at (\tkzshapebrickfigname-LOGO) {\resizebox{!}{\tkzbrickfigheightlogo}{\tkzshapebrickfiglogo}};}%
715 {}%
716 \ifboolKV[tkzshapebrickfig]{custom logo}%with scale propagated
717 {\node[inner sep=0pt] at (\tkzshapebrickfigname-LOGO) {\tkzshapebrickfiglogo} ;}%play with \tkzbrickfigscale...
718 %{\node[inner sep=0pt,scale=\fpeval{1/(\tkzbrickfigscale)}] at (\tkzshapebrickfigname-LOGO) {\tkzshapebrickfiglogo} ;}%
719 {}%
720 \ifdefempty{\tkzshapebrickadjustlogo}%with adjusted logo (test...)
721 {}%
722 {\node[inner sep=0pt] at (\tkzshapebrickfigname-LOGO) {\adjustlogotosweat{\tkzshapebrickadjustlogo}} ;}%
723 \end{scope}
724 \end{tikzpicture}%
725 }
726
727 \NewDocumentCommand\minitikzbrickfigurine{O{}D<>{}mm}{%gestion des 10...
728 \IfStrEq{#4}{*}%
729 {%full random
730 \xdef\tmpNUMmouth{\fpeval{randint(1,10)}}%
731 \xdef\tmpNUMeye{\fpeval{randint(1,10)}}%
732 \xdef\tmpNUMeyebrow{\fpeval{randint(1,10)}}%
733 \xdef\tmpNUMhair{\fpeval{randint(1,10)}}%
734 }%
735 {%partial random
736 \setsepchar[.]{/}%
737 \readlist*\tmpNUMlist{#4}%
738 \itemtomacro\tmpNUMlist[1]\tmpNUMmouth%
739 \IfStrEq{\tmpNUMmouth}{*}{\xdef\tmpNUMmouth{\fpeval{randint(1,10)}}}{}%
740 \itemtomacro\tmpNUMlist[2]\tmpNUMeye%
741 \IfStrEq{\tmpNUMeye}{*}{\xdef\tmpNUMeye{\fpeval{randint(1,10)}}}{}%
742 \itemtomacro\tmpNUMlist[3]\tmpNUMeyebrow%
743 \IfStrEq{\tmpNUMeyebrow}{*}{\xdef\tmpNUMeyebrow{\fpeval{randint(1,10)}}}{}%
744 \itemtomacro\tmpNUMlist[4]\tmpNUMhair%
745 \IfStrEq{\tmpNUMhair}{*}{\xdef\tmpNUMhair{\fpeval{randint(0,10)}}}{}%
746 }%
747 \tikzbrickfigurine[#1,mouthstyle=\tmpNUMmouth,hairstyle=\tmpNUMhair,eyestyle=\tmpNUMeye,eyebrowstyle=\tmpNUMeyebrow]<#2>{#3}%
748 }
749
750 \NewDocumentCommand\tikzbrickfigurinepiece{O{}D<>{}mm}{%
751 \restoreKV[tkzshapebrickfig]%
752 \setKV[tkzshapebrickfig]{#1}%
753 \ifboolKV[tkzshapebrickfig]{vcenter}%
754 {\tikzset{brickfig shape vcenter/.style={baseline=(current bounding box.center)}}}%
755 {\tikzset{brickfig shape vcenter/.style={}}}%
756 \setlength\tkzbrickfigheight{#4}%
757 \xdef\tkzbrickfigscale{\fpeval{\tkzbrickfigheight/16cm}}%
758 \begin{tikzpicture}[\tkzshapebrickfiglinescolor,scale=\tkzbrickfigscale,line width=\fpeval{\tkzbrickfigscale*0.8}mm,line join=round,line cap=round,#2,brickfig shape vcenter,transform shape]
759 \IfStrEq{#3}{head}{\setKV[tkzshapebrickfig]{head=true}}{}%
760 \IfStrEq{#3}{legs}{\setKV[tkzshapebrickfig]{head=false}}{}%
761 \IfStrEq{#3}{body}{\setKV[tkzshapebrickfig]{head=false}}{}%
762 \ifboolKV[tkzshapebrickfig]{head}%
763 {%
764 \IfSubStr{#3}{hair=}{}{\draw[brickfig shape head] (-1,{5.45+3.385}) {[rounded corners=\fpeval{\tkzbrickfigscale*2}mm] --++ (0,0.7) --++ (2,0)} --++ (0,-0.7) -- cycle ;}%
765 \inttkzshapebrickfighead
766 \inttkzshapebrickfigneck
767 }%
768 {}%
769 \inttkzshapebrickfignodes
770 %individual element ?
771 \IfSubStr{#3}{head=}%
772 {%
773 \inttkzshapebrickfighead
774 \inttkzshapebrickfigneck
775 \StrBehind{#3}{head=}[\tmpnbheadlist]%
776 \IfStrEq{\tmpnbheadlist}{*}%
777 {%
778 \xdef\tmpNUMmouth{\fpeval{randint(1,10)}}%
779 \xdef\tmpNUMeye{\fpeval{randint(1,10)}}%
780 \xdef\tmpNUMeyebrow{\fpeval{randint(1,10)}}%
781 \xdef\tmpNUMhair{\fpeval{randint(1,10)}}%
782 }%
783 {%
784 \setsepchar[.]{/}%
785 \readlist*\tmpNUMlist{\tmpnbheadlist}%
786 \itemtomacro\tmpNUMlist[1]\tmpNUMmouth%
787 \IfStrEq{\tmpNUMmouth}{*}{\xdef\tmpNUMmouth{\fpeval{randint(1,10)}}}{}%
788 \itemtomacro\tmpNUMlist[2]\tmpNUMeye%
789 \IfStrEq{\tmpNUMeye}{*}{\xdef\tmpNUMeye{\fpeval{randint(1,10)}}}{}%
790 \itemtomacro\tmpNUMlist[3]\tmpNUMeyebrow%
791 \IfStrEq{\tmpNUMeyebrow}{*}{\xdef\tmpNUMeyebrow{\fpeval{randint(1,10)}}}{}%
792 \itemtomacro\tmpNUMlist[4]\tmpNUMhair%
793 \IfStrEq{\tmpNUMhair}{*}{\xdef\tmpNUMhair{\fpeval{randint(0,10)}}}{}%
794 }%
795 %parts
796 \inttkzshapebrickfigmouth{\tmpNUMmouth}
797 \inttkzshapebrickfigeye{\tmpNUMeye}
798 \inttkzshapebrickfigeyebrow{\tmpNUMeyebrow}
799 \inttikzshapehair{\tmpNUMhair}
800 }%
801 {}%
802 \IfSubStr{#3}{mouth=}%
803 {%
804 \StrBehind{#3}{mouth=}[\tmpnbmouth]%
805 \inttkzshapebrickfigmouth{\tmpnbmouth}
806 }%
807 {}%
808 \IfSubStr{#3}{eyes=}%
809 {%
810 \StrBehind{#3}{eyes=}[\tmpnbeye]%
811 \inttkzshapebrickfigeye{\tmpnbeye}
812 }%
813 {}%
814 \IfSubStr{#3}{eyebrows=}%
815 {%
816 \StrBehind{#3}{eyebrows=}[\tmpnbeyebrow]%
817 \inttkzshapebrickfigeyebrow{\tmpnbeyebrow}
818 }%
819 {}%
820 \IfSubStr{#3}{hair=}%
821 {%
822 \StrBehind{#3}{hair=}[\tmpnbhair]%
823 \inttikzshapehair{\tmpnbhair}
824 }%
825 {}%
826 \IfStrEq{#3}{body}%
827 {%
828 \draw[brickfig shape body] (-0.85,5) rectangle++ ({2*0.85},1.95) ;%scratch
829 \inttkzshapebrickfigbody
830 \inttkzshapebrickfigarms
831 }%
832 {}%
833 \IfStrEq{#3}{legs}%
834 {%
835 \inttkzshapebrickfigpant
836 %scratchs
837 \draw[brickfig shape belt] (-2.35,0) -- (-2.35,0.65) -- (-2.2,1.75) -- (-0.675,1.75) |- cycle ;
838 \draw[brickfig shape belt] (2.35,0) -- (2.35,0.65) -- (2.2,1.75) -- (0.675,1.75) |- cycle ;
839 }%
840 {}%
841 \IfStrEq{#3}{left arm}{%
842 \inttkzshapebrickfigleftarm
843 \inttkzshapebrickfigleftarmscratch
844 }{}%
845 \IfStrEq{#3}{left arm wo hand}{\inttkzshapebrickfigleftarmwohand}{}%
846 \IfStrEq{#3}{right arm}{%
847 \inttkzshapebrickfigrightarm
848 \inttkzshapebrickfigrightarmscratch
849 }{}%
850 \IfStrEq{#3}{right arm wo hand}{\inttkzshapebrickfigrightarmwohand}{}%
851 \IfStrEq{#3}{left hand}{\inttkzshapebrickfiglefthand}{}%
852 \IfStrEq{#3}{right hand}{\inttkzshapebrickfigrighthand}{}%
853 \end{tikzpicture}%
854 }
855
856 \endinput