summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzpingus/tikzpingus-christmas.lib.tex
blob: b86e799d79f1cfe18debf70531ccd3ccca816215 (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
% Florian Sihler, 2022
% Licensed under GNU General Public License version 3
% https://opensource.org/licenses/gpl-3.0.html
\pingu@create@extra{santahat}{%
    santa hat/.code             = \pingu@set@extra{santahat}{true}\pingu@color{santahat}{#1}\pgfqkeys{/pingu}{hair=\@pingu@none},
    santa hat/.default          = pingu@red!87!pingu@black,
    santa hat second/.code      = \pingu@color{santahat@second}{#1},
    santa hat bobble/.code      = \pingu@color{santahat@bobble}{#1}
}{santa hat second={pingu@white!97!\pingu@color@santahat},santa hat bobble={\pingu@color@santahat@second}}
\def\pingu@draw@ea@santahat{%
\path (\pingu@name-head-center)+(152:\pingu@w@half{} and \pingu@head@h@half) coordinate (\pingu@name-santa-right);
\path (\pingu@name-head-center)+(5:\pingu@w@half{} and \pingu@head@h@half) coordinate (\pingu@name-santa-left);
\pingu@layer{middle}[]
\pingu@block{\pingu@color@santahat@second} (\pingu@name-santa-right) to[out=48,in=132] (\pingu@name-santa-left) to[out=30,in=-45,looseness=1.325] ++(0,3.2mm)
to[out=135,in=47,looseness=1.025] coordinate[pos=.915] (\pingu@name-santa-ur) coordinate[pos=.055] (\pingu@name-santa-ul) ([yshift=2mm]\pingu@name-santa-right) to[out=240,in=140] cycle;
\endpingu@layer
\pingu@layer{background}[]
\pingu@block{\pingu@color@santahat} (\pingu@name-santa-ur) arc(145:-25:11.85mm and 14.915mm)
    to[bend right=7] coordinate[pos=.5] (\pingu@name-santa-lc) ++(-1.11mm,.375mm) to[bend right=11] (\pingu@name-santa-ul) to[bend right=15] cycle;
\pingu@block{\pingu@color@santahat@bobble} (\pingu@name-santa-lc) circle[radius=2.625mm];
\endpingu@layer
}
\pingu@create@extra{santabeard}{%
    santa beard/.code             = \pingu@set@extra{santabeard}{true}\pingu@color{santabeard}{#1},
    santa beard/.default          = pingu@white!96!pingu@red!98!pingu@black!92!gray,
    santa beard string/.code      = \pingu@color{santabeard@string}{#1}
}{santa beard string=\pingu@color@body@main!85!pingu@black}
\def\pingu@draw@ea@santabeard{%
% \coordinate (\pingu@name-santa-beard-center) at ([yshift=1.25mm]\pingu@name-belly-center);
\pingu@block{\pingu@color@santabeard@string} ([xshift=-.35mm,yshift=.575mm]\pingu@name-head-back-con-right) to[bend right=28,edge node={foreach[count=\i] \l in {0.03,0.085,...,0.992} {coordinate[pos=\l-rand*.015,yshift=-.85pt] (\pingu@name-santa-beard-\i)}}]
([yshift=.575mm,xshift=.35mm]\pingu@name-head-back-con-left) arc(20:110:.05mm and .15mm) to[bend left=26] ([yshift=.575mm+.15mm,xshift=-.35mm]\pingu@name-head-back-con-right) to[bend right] cycle;
\ifx\pingu@color@santabeard\@pingu@none\else% to allow for random
\xdef\@pmaxY{18}\xdef\@pmaxYI{17}%
\foreach[evaluate=\j as \maxj using int(\@pmaxY-\j),evaluate=\j as \widthred using \j/23pt] \j in {0,...,\@pmaxYI} {
\foreach[remember=\i as \li (initially 0)] \i in {1,...,\maxj} {
    \pgfmathsetmacro\@ptmp{94+rand*2.6}
    \pingu@block{\pingu@color@santabeard!\@ptmp!pingu@black} (\pingu@name-santa-beard-\i) circle [radius=1.85pt-\widthred pt+rand*.35pt];
    \ifnum\li>0 % make middle of last
        \path (\pingu@name-santa-beard-\li) -- (\pingu@name-santa-beard-\i) coordinate[pos=.5,yshift=-1.1pt,xshift=.133pt] (\pingu@name-santa-beard-\li); % smoll shift
    \fi
}}\fi
}

\pingu@create@extra{woolhat}{%
    wool hat/.code             = \pingu@set@extra{woolhat}{true}\pingu@color{woolhat}{#1}\pgfqkeys{/pingu}{hair=\@pingu@none},
    wool hat/.default          = pingu@blue!57!pingu@black,
    wool hat second/.code      = \pingu@color{woolhat@second}{#1},
    wool hat bobble/.code      = \pingu@color{woolhat@bobble}{#1}
}{wool hat second={\pingu@color@woolhat!55!pingu@white},wool hat bobble={\pingu@color@woolhat@second}}
\def\pingu@draw@ea@woolhat{%
\path ([yshift=.5mm,xshift=.165mm]\pingu@name-head-center)+(165:\pingu@w@half{} and \pingu@head@h@half) coordinate (\pingu@name-wool-right);
\path ([yshift=.5mm,xshift=-.045mm]\pingu@name-head-center)+(4:\pingu@w@half{} and \pingu@head@h@half) coordinate (\pingu@name-wool-left);
\pingu@layer{middle}[]
\pingu@block{\pingu@color@woolhat@second} (\pingu@name-wool-right) to[out=37,in=170] (\pingu@name-wool-left) to[out=50,in=-55] ++(0,1.52mm) coordinate (\pingu@name-wool-left-up)
to[out=167,in=38] coordinate[pos=.915] (\pingu@name-wool-ur) coordinate[pos=.055] (\pingu@name-wool-ul) ([yshift=1.5mm]\pingu@name-wool-right) coordinate (\pingu@name-wool-right-up) to[out=240,in=140] cycle;
\endpingu@layer
\path (\pingu@name-wool-left-up) -- (\pingu@name-wool-right-up) coordinate[pos=.455,yshift=9.75mm] (@mid);
\pingu@block{\pingu@color@woolhat} (\pingu@name-wool-right-up) to[out=71,in=203] [rounded corners=2pt] (@mid) to[out=-34,in=100]  [sharp corners]  (\pingu@name-wool-left-up) to[in=37,out=172] cycle;
\pingu@layer{background}[]
\pingu@block{\pingu@color@woolhat@bobble} (@mid) circle [radius=1.25mm];
\endpingu@layer
}


\pingu@create@extra{deerhat}{%
    deer hat/.code             = \pingu@set@extra{deerhat}{true}\pingu@color{deerhat}{#1}\pgfqkeys{/pingu}{hair=\@pingu@none},
    deer hat/.default          = pingu@bronze!57!pingu@black,
    deer hat b/.code           = \pingu@color{deerhat@b}{#1},
    deer hat band/.code        = \pingu@color{deerhat@band}{#1},
}{deer hat band={\pingu@color@deerhat!85!pingu@black},deer hat b=\pingu@color@deerhat}
\pgfmathsetmacro\pingu@deerhat@baseang@l{90-360*(1-\pinguanglehl)}
\pgfmathsetmacro\pingu@deerhat@baseang@r{90-360*(1-\pinguanglehr)}
\def\pingu@deerhat@baseoff{47}
\def\pingu@deerhat@yshift{.15mm}
\def\pingu@deerhat@linewidth{1.32mm}
\def\pingu@deerhat@headoff@l{22}
\def\pingu@deerhat@headoff@r{19}
\def\pingu@draw@ea@deerhat{%
\path ([yshift=-\pingu@deerhat@yshift]\pingu@name-head-left) arc (\pingu@deerhat@baseang@l:\pingu@deerhat@baseang@l-\pingu@deerhat@baseoff:\pingu@w@half{} and \pingu@head@h@half) coordinate[yshift=.05mm] (@target);
\pingu@draw[line width=.7mm]{\pingu@color@deerhat@band} ([xshift=-.8mm]@target) arc (\pingu@deerhat@baseang@l-\pingu@deerhat@baseoff:360+\pingu@deerhat@baseang@r+\pingu@deerhat@baseoff:\pingu@w@half{}-.8mm and \pingu@head@h@half);

\path ([yshift=-\pingu@deerhat@yshift]\pingu@name-head-top) arc (90:90-\pingu@deerhat@headoff@l:\pingu@w@half{} and \pingu@head@h@half) coordinate (@left);
\path ([yshift=-\pingu@deerhat@yshift]\pingu@name-head-top) arc (90:90+\pingu@deerhat@headoff@r:\pingu@w@half{} and \pingu@head@h@half) coordinate (@right);

\pgfonlayer{background}
\pingu@draw[line width=\pingu@deerhat@linewidth,rounded corners=2pt,line cap=round]{\pingu@color@deerhat} (@left) to[bend right=4] ++(.85mm,1.5mm) coordinate (@a) -- ++(3.15mm,.5mm) coordinate (@b) -- ++(4.65mm,4.35mm) coordinate[pos=.5] (@c) to[bend right=10] ++(-.75mm,2.55mm);
\pingu@draw[line width=\pingu@deerhat@linewidth,rounded corners=2pt,line cap=round]{\pingu@color@deerhat} ([xshift=-.135mm,yshift=-.425mm]@a) to[bend left=3] ++(1mm,3.9mm) ([xshift=-.4mm,yshift=-.05mm]@b) to[bend right=2] ++(3.75mm,.1mm) (@c) to[bend left=12] ++(-1mm,3.5mm);
\pingu@draw[line width=\pingu@deerhat@linewidth,rounded corners=2pt,line cap=round]{\pingu@color@deerhat@b} (@right) to[bend left=4] ++(-.85mm,1.5mm) coordinate (@a) -- ++(-3.15mm,.5mm) coordinate (@b) -- ++(-4.65mm,4.35mm) coordinate[pos=.5] (@c) to[bend left=10] ++(.75mm,2.55mm);
\pingu@draw[line width=\pingu@deerhat@linewidth,rounded corners=2pt,line cap=round]{\pingu@color@deerhat@b} ([yshift=-.425mm,xshift=.135mm]@a) to[bend right=3] ++(-1mm,3.9mm) ([xshift=.4mm,yshift=-.05mm]@b) to[bend right=2] ++(-3.75mm,.1mm) (@c) to[bend right=12] ++(1mm,3.5mm);
\endpgfonlayer
}

\pingu@create@wing@extra{present}{%
  present \@lr/.code              = {\pingu@set@extra{present\@lr}{true}\pingu@color{present\@lr}{##1}},
  present \@lr/.default           = pingu@red!50!pingu@black!60!red,
  present \@lr\space width/.code  = \@namedef{pingu@present@\@lr @width}{##1},
  present \@lr\space height/.code = \@namedef{pingu@present@\@lr @height}{##1},
  present \@lr\space ribbon/.code   = \pingu@color{present\@lr @ribbon}{##1},%
  present \@lr\space band/.code   = \pingu@color{present\@lr @band}{##1},%
  present \@lr\space band width/.code  = \@namedef{pingu@present@\@lr @band@width}{##1},
  present \@lr\space xshift/.code = \@namedef{pingu@present@\@lr @xshift}{##1},
  present \@lr\space yshift/.code = \@namedef{pingu@present@\@lr @yshift}{##1},
  present \@lr\space band second height/.code = \@namedef{pingu@present@\@lr @band@second@height}{##1},
  present \@lr\space band second yshift/.code = \@namedef{pingu@present@\@lr @band@second@yshift}{##1},
  present \@lr\space lid/.code   = \pingu@color{present\@lr @lid}{##1},%
  present \@lr\space lid height/.code = \@namedef{pingu@present@\@lr @lid@height}{##1},
  present \@lr\space lid overhang/.code = \@namedef{pingu@present@\@lr @lid@overhang}{##1},
  present \@lr\space lid yshift/.code = \@namedef{pingu@present@\@lr @lid@yshift}{##1},
  present \@lr\space lid band/.code   = \pingu@color{present\@lr @lid@band}{##1},%
}{present \@lr\space band=pingu@green!70!pingu@black!90!pingu@white,present \@lr\space width=7.75mm,present \@lr\space band width=1.75mm,present \@lr\space height=7mm,present \@lr\space yshift=-0.25*(\csname pingu@present@\@lr @height\endcsname),present \@lr\space band second height=\csname pingu@present@\@lr @band@width\endcsname, present \@lr\space band second yshift=0.5*(\csname pingu@present@\@lr @height\endcsname),present \@lr\space xshift=-0.25*(\csname pingu@present@\@lr @width\endcsname),present \@lr\space lid=\csname pingu@color@present\@lr\endcsname!92!pingu@black,present \@lr\space lid height=1.33mm,present \@lr\space lid overhang=.125mm,present \@lr\space lid yshift=0,present \@lr\space lid band=\csname pingu@color@present\@lr @band\endcsname!98!pingu@black,present \@lr\space ribbon=\csname pingu@color@present\@lr @band\endcsname!97!pingu@black}

% TODO: more ribbon color control
% #1 wing
\def\pingu@draw@wi@present#1{%
    \pingu@setup@wing{present}{#1}%
    \scope[rotate around={\@angle:(\pingu@name-wing-#1)}]
        \pingu@block[rounded corners=2pt]{\@col}(\pingu@name-wing-#1)++(-{0.5*(\csname pingu@present@#1@width\endcsname)+\csname pingu@present@#1@xshift\endcsname},{\csname pingu@present@#1@yshift\endcsname}) coordinate (@ll) rectangle ++({\csname pingu@present@#1@width\endcsname},{\csname pingu@present@#1@height\endcsname}) coordinate (@ur);
        % vert band
        \pingu@block{\csname pingu@color@present#1@band\endcsname}(@ll)++({0.5*(\csname pingu@present@#1@width\endcsname)-0.5*(\csname pingu@present@#1@band@width\endcsname)},0) rectangle ++({\csname pingu@present@#1@band@width\endcsname},{\csname pingu@present@#1@height\endcsname});
        % horiz band
        \pingu@block{\csname pingu@color@present#1@band\endcsname}(@ll)++(0,{\csname pingu@present@#1@band@second@yshift\endcsname-0.5*(\csname pingu@present@#1@band@second@height\endcsname)}) rectangle ++({\csname pingu@present@#1@width\endcsname},{\csname pingu@present@#1@band@second@height\endcsname});
        % lid
        \pingu@block[rounded corners=.75pt]{\csname pingu@color@present#1@lid\endcsname} ([yshift={\csname pingu@present@\@lr @lid@yshift\endcsname},xshift=\csname pingu@present@\@lr @lid@overhang\endcsname]@ur) rectangle ++({-\csname pingu@present@#1@width\endcsname-2*(\csname pingu@present@\@lr @lid@overhang\endcsname)},-\csname pingu@present@#1@lid@height\endcsname) coordinate (@ll);
        % upper lid band
        \pingu@block{\csname pingu@color@present#1@lid@band\endcsname}(@ll)++({0.5*(\csname pingu@present@#1@width\endcsname)-0.5*(\csname pingu@present@#1@band@width\endcsname)+\csname pingu@present@\@lr @lid@overhang\endcsname},0) rectangle ++({\csname pingu@present@#1@band@width\endcsname},{\csname pingu@present@#1@lid@height\endcsname});
        % ribbon
        \path (@ll)++({0.5*(\csname pingu@present@#1@width\endcsname)+\csname pingu@present@\@lr @lid@overhang\endcsname+0.2*(\csname pingu@present@#1@band@width\endcsname)},{\csname pingu@present@#1@lid@height\endcsname+.25mm}) coordinate (@top);
        \pingu@block[even odd rule]{\csname pingu@color@present#1@ribbon\endcsname} (@top) to[out=40,in=110] ++(4mm,1mm)
        to[out=-70,in=-20] ++(-4mm,-1.5mm) to[bend left=55] cycle ([xshift=.5mm]@top) to[out=40,in=110] ++(2.55mm,.5mm)
        to[out=-70,in=-20] [rounded corners=1pt] ++(-2.85mm,-.835mm) -- cycle;
        \path (@ll)++({0.5*(\csname pingu@present@#1@width\endcsname)+\csname pingu@present@\@lr @lid@overhang\endcsname-0.2*(\csname pingu@present@#1@band@width\endcsname)},{\csname pingu@present@#1@lid@height\endcsname+.25mm}) coordinate (@top);
        \pingu@block[even odd rule]{\csname pingu@color@present#1@ribbon\endcsname} (@top) to[out=180-40,in=180-110] ++(-3.6mm,1mm)
        to[out=-110,in=-160] ++(3.6mm,-1.5mm) to[bend right=55] cycle ([xshift=-.5mm]@top) to[out=140,in=70] ++(-2.55mm,.5mm)
        to[out=-110,in=-160] [rounded corners=1pt] ++(2.55mm,-.75mm) -- cycle;
        \pingu@block[rounded corners=.5pt]{\csname pingu@color@present#1@ribbon\endcsname} (@top)++(-.3mm,-.65mm) rectangle ++(1.3mm,.65mm); % TODO: make that round? (i.e., bend edges)
    \endscope
}

\pingu@create@wing@extra{snowball}{%
  snowball \@lr/.code         = {\pingu@set@extra{snowball\@lr}{true}\pingu@color{snowball\@lr}{##1}},
  snowball \@lr/.default      = pingu@white!90!pingu@black,
  snowball \@lr\space size/.code  = \expandafter\def\csname pingu@snowball@\@lr @size\endcsname{##1},
  snowball \@lr\space xshift/.code  = \expandafter\def\csname pingu@snowball@\@lr @xshift\endcsname{##1},
  snowball \@lr\space yshift/.code  = \expandafter\def\csname pingu@snowball@\@lr @yshift\endcsname{##1}
}{snowball \@lr\space size=2.33mm, snowball \@lr\space xshift=0pt, snowball \@lr\space yshift=0pt}

% #1 wing
% TODO: shifts
\def\pingu@draw@wi@snowball#1{%
\pingu@setup@wing{snowball}{#1}%
    \pingu@draw[opacity=.35]{\@col} ([xshift=\csname pingu@snowball@#1@xshift\endcsname,yshift=\csname pingu@snowball@#1@yshift\endcsname]\pingu@name-wing-#1) coordinate (@) circle[radius=\csname pingu@snowball@#1@size\endcsname];
    \pingu@block[rotate around={\@angle-1:(\pingu@name-wing-#1)},decoration={random steps,segment length=1pt,amplitude=.075pt},decorate,rounded corners=.35pt,save path=\snowball@outer]{\@col}(@) circle[radius=\csname pingu@snowball@#1@size\endcsname];
}