summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzpingus/tikzpingus-hats.lib.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikzpingus/tikzpingus-hats.lib.tex')
-rw-r--r--graphics/pgf/contrib/tikzpingus/tikzpingus-hats.lib.tex115
1 files changed, 115 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/tikzpingus/tikzpingus-hats.lib.tex b/graphics/pgf/contrib/tikzpingus/tikzpingus-hats.lib.tex
new file mode 100644
index 0000000000..4e31000e8f
--- /dev/null
+++ b/graphics/pgf/contrib/tikzpingus/tikzpingus-hats.lib.tex
@@ -0,0 +1,115 @@
+% Florian Sihler, 2022
+% Licensed under GNU General Public License version 3
+% https://opensource.org/licenses/gpl-3.0.html
+\pingu@create@extra{strawhat}{%
+ % extra strawhat (tikzducks basis)
+ straw hat/.forward to = /pingu/strawhat,
+ strawhat/.default = brown!50!white,
+ strawhat/.code = \pingu@set@extra{strawhat}{true}\pingu@color{strawhat}{#1},
+ straw hat ribbon/.forward to = /pingu/strawhat ribbon,
+ strawhat ribbon/.code = \pingu@color{strawhat@ribbon}{#1},
+ straw hat position/.forward to= /pingu/strawhat position,
+ strawhat position/.code args = {#1:(#2,#3)#4}{\def\pingu@x@strawhat@angle{#1}\def\pingu@x@strawhat@xshift{#2}\def\pingu@x@strawhat@yshift{#3}\def\pingu@x@strawhat@scale{#4}},
+}{strawhat ribbon= gray!85!black,strawhat position={-26.5:(-.185cm,.14cm){1.375}}}
+
+\def\pingu@draw@ea@strawhat{%
+\scope[rotate around={\pingu@x@strawhat@angle:(\pingu@name-head)},shift={(\pingu@name-head)},shift={(\pingu@x@strawhat@xshift,\pingu@x@strawhat@yshift)},scale=\pingu@x@strawhat@scale]
+\pingu@block{\pingu@color@strawhat} (.34cm,0) ellipse[x radius=.75cm, y radius=\pingu@one];
+\pingu@block{\pingu@color@strawhat} (0,.5mm) rectangle (.68cm,5mm);
+\pingu@block{\pingu@color@strawhat} (.34cm,5mm) ellipse[x radius=.34cm, y radius=.8mm];
+\pingu@block{\pingu@color@strawhat} (-.3955cm,.2mm) -- (1.0755cm,.2mm) -- (.68cm,2mm) -- (0,2mm) -- cycle;
+\pingu@block{\pingu@color@strawhat@ribbon} (.34cm,2mm) ellipse[x radius=.34cm, y radius=.8mm];
+\pingu@block{\pingu@color@strawhat@ribbon} (0,2mm) rectangle (.68cm,3mm);
+\pingu@block{\pingu@color@strawhat} (.34cm,3mm) ellipse[x radius=.34cm, y radius=.8mm];
+\endscope}
+
+\pingu@create@extra{hat}{%
+ hat/.default = pingu@black!90!black,
+ hat/.code = \pingu@set@extra{hat}{true}\pingu@color{hat}{#1},
+ hat base/.code = \pingu@color{hat@base}{#1},
+ hat coronal/.code = \pingu@color{hat@coronal}{#1},
+ hat ribbon/.code = \pingu@color{hat@ribbon}{#1},
+ hat position/.code args = {#1:(#2,#3)#4}{\def\pingu@x@hat@angle{#1}\def\pingu@x@hat@xshift{#2}\def\pingu@x@hat@yshift{#3}\def\pingu@x@hat@scale{#4}},
+}{hat position={-2:(.35mm,0)1},hat base=\pingu@color@hat,hat coronal=\pingu@color@hat!91!white,hat ribbon=\pingu@color@hat!87!white}
+
+\newdimen\pingu@hat@w@half \pingu@hat@w@half=.925cm
+\newdimen\pingu@hat@h \pingu@hat@h=.625cm
+\def\pingupathhatupper{[rounded corners=.25mm](-.65cm,-.25cm) to[out=90,in=200] ++(.35cm,\pingu@hat@h) to[bend left=11] ++(.25cm,0) to[bend right=2.5] ++(\pingu@one,0) to[bend left=11] ++(.25cm,0) to[out=-20,in=90] ++(.35cm,-\pingu@hat@h) to[bend left=12] (-.65cm,-.25cm) -- cycle}
+\def\pingu@draw@ea@hat{%
+\scope[rotate around={\pingu@x@hat@angle:(\pingu@name-head-top)},shift={(\pingu@name-head-top)},shift={(\pingu@x@hat@xshift,\pingu@x@hat@yshift)},scale=\pingu@x@hat@scale]
+\pingu@block[/pingu/@draw=\pingu@color@hat@coronal,thick]{\pingu@color@hat@base} (0,-.25cm)++(180:\pingu@hat@w@half{} and .15cm) arc (180:360:\pingu@hat@w@half{} and .15cm) arc (0:180:\pingu@hat@w@half{} and .115cm) -- cycle;
+\pingu@block{\pingu@color@hat} \pingupathhatupper;
+\scope
+\clip\pingupathhatupper;
+\pingu@block{\pingu@color@hat@ribbon} (\z@,.2mm) ellipse [x radius=.95\pingu@hat@w@half, y radius=.13cm];
+\pingu@block{\pingu@color@hat} (\z@,.134cm) ellipse [x radius=.95\pingu@hat@w@half, y radius=.13cm];
+\endscope\endscope}
+
+\pingu@create@extra{cap}{%
+ cap/.default = pingu@bronze,
+ cap/.code = \pingu@set@extra{cap}{true}\pingu@color{cap}{#1},
+ cap padding/.code = {\def\pingu@x@cap@padding{#1}},
+ cap extra height/.code = {\def\pingu@x@cap@height{#1}},
+}{cap padding=.8mm, cap extra height=0pt}
+
+\def\pingu@draw@ea@cap{%
+\pingu@layer{foreground}[]
+\pingu@block[rounded corners=.7mm]{\pingu@color@cap} ([xshift=.25mm]\pingu@name-wing-left-start) to[bend left=4] ([xshift=-\pingu@x@cap@padding]\pingu@name-wings-side-left) to[bend right=3]
+([yshift=\pingu@x@cap@height]\pingu@name-head)
+to[bend right=3]
+([xshift=\pingu@x@cap@padding]\pingu@name-wings-side-right) [rounded corners=.15mm] to[bend left=4] ([xshift=-.25mm]\pingu@name-wing-right-start)
+to[bend left=8]
+([xshift=-\pingu@x@cap@padding]\pingu@name-wings-side-right)
+[rounded corners=.15mm]
+to[bend left=32] ++(\pingu@w@half+\pingu@x@cap@padding,\pingu@w@half+\pingu@one)
+to[bend left=32] ++(\pingu@w@half+\pingu@x@cap@padding,-\pingu@w@half-\pingu@one)
+to[bend left=8] cycle;
+\endpingu@layer
+}
+
+\pingu@create@extra{constructionhelmet}{%
+ construction helmet/.default = pingu@yellow,
+ construction helmet/.code = \pingu@set@extra{constructionhelmet}{true}\pingu@color{constructionhelmet}{#1},
+ construction helmet padding/.code = {\def\pingu@x@constructionhelmet@padding{#1}},
+ construction helmet extra height/.code = {\def\pingu@x@constructionhelmet@height{#1}},
+ construction helmet position/.code args = {#1:(#2,#3)#4}{\def\pingu@x@constructionhelmet@angle{#1}\def\pingu@x@constructionhelmet@xshift{#2}\def\pingu@x@constructionhelmet@yshift{#3}\def\pingu@x@constructionhelmet@scale{#4}},
+}{construction helmet padding=.325cm, construction helmet extra height=0pt,construction helmet position={-.5:(.05mm,-1.25mm)1}}
+
+\newdimen\pingu@constructionhelmet@w@half \pingu@constructionhelmet@w@half=.85cm
+\def\pingu@draw@ea@constructionhelmet{%
+\scope[rotate around={\pingu@x@constructionhelmet@angle:(\pingu@name-head-top)},shift={(\pingu@name-head-top)},shift={(\pingu@x@constructionhelmet@xshift,\pingu@x@constructionhelmet@yshift)},scale=\pingu@x@constructionhelmet@scale]
+\pingu@block{\pingu@color@constructionhelmet} (0,-.25cm)++(180:\pingu@constructionhelmet@w@half{} and \pingu@x@constructionhelmet@padding) arc (180:360:\pingu@constructionhelmet@w@half{} and \pingu@x@constructionhelmet@padding) arc (0:180:\pingu@constructionhelmet@w@half{} and .2cm) -- cycle;
+\scope
+\pingu@block{\pingu@color@constructionhelmet!93!pingu@black} (0,-.25cm)++(0:{.95\pingu@constructionhelmet@w@half} and .675cm) arc (0:180:{.95\pingu@constructionhelmet@w@half} and .675cm) coordinate[pos=.212] (@a) coordinate[pos=.256] (@aa) coordinate[pos=.788] (@b) coordinate[pos=.744] (@bb) arc (180:360:{.95\pingu@constructionhelmet@w@half} and .125cm) -- cycle;
+\clip (0,-.25cm)++(0:{.95\pingu@constructionhelmet@w@half} and .675cm) arc (0:180:{.95\pingu@constructionhelmet@w@half} and .675cm) arc (180:360:{.95\pingu@constructionhelmet@w@half} and .125cm) -- cycle;
+\pingu@block{\pingu@color@constructionhelmet!99!pingu@black} (-.75mm,-.25cm-.125cm) to[bend left=1] ++ (0,.675cm+.125cm) -- ++(1.5mm,0) to[bend right=1] ++(0,-.675cm-.125cm) -- cycle;
+\pingu@block{\pingu@color@constructionhelmet!99!pingu@black} (-.95mm,-.25cm-.125cm) to[bend left=3] ++ (-8mm,.675cm+.125cm) -- ++(1.5mm,0) to[bend right=3] ++(8mm,-.675cm-.125cm) -- cycle;
+\pingu@block{\pingu@color@constructionhelmet!99!pingu@black} (-.55mm,-.25cm-.125cm) to[bend right=3] ++ (8mm,.675cm+.125cm) -- ++(1.5mm,0) to[bend left=3] ++(-8mm,-.675cm-.125cm) -- cycle;
+\endscope
+% get the 3d wobbles
+\pingu@block[rounded corners=.03mm]{\pingu@color@constructionhelmet!99!pingu@black} (-.75mm,-.25cm+.675cm-.25mm) -- ++(0,.3mm) -| ++(1.5mm,-.3mm) -- cycle;
+\pingu@block{\pingu@color@constructionhelmet!99!pingu@black} (@a) to[bend right=14] (@aa);
+\pingu@block{\pingu@color@constructionhelmet!99!pingu@black} (@bb) to[bend right=14] (@b);
+\endscope
+}
+
+\pingu@create@extra{conicalhat}{%
+ conical hat/.default = pingu@bronze,
+ conical hat/.code = \pingu@set@extra{conicalhat}{true}\pingu@color{conicalhat}{#1},
+ conical hat rounding/.code = {\def\pingu@x@conicalhat@rounding{#1}},
+ conical hat shade/.code = {\def\pingu@x@conicalhat@shade{#1}},
+ conical hat height/.code = {\def\pingu@x@conicalhat@height{#1}},
+ conical hat width/.code = {\def\pingu@x@conicalhat@width{#1}},
+ conical hat position/.code args = {#1:(#2,#3)#4}{\def\pingu@x@conicalhat@angle{#1}\def\pingu@x@conicalhat@xshift{#2}\def\pingu@x@conicalhat@yshift{#3}\def\pingu@x@conicalhat@scale{#4}},
+}{conical hat position={-15:(2mm,-3mm)1}, conical hat height=8mm, conical hat width=2.25cm,conical hat shade=\pingu@color@conicalhat!80!pingu@black, conical hat rounding=.4pt}
+
+\def\pingu@draw@ea@conicalhat{%
+\scope[rotate around={\pingu@x@conicalhat@angle:(\pingu@name-head-top)},shift={(\pingu@name-head-top)},shift={(\pingu@x@conicalhat@xshift,\pingu@x@conicalhat@yshift)},scale=\pingu@x@conicalhat@scale]
+
+\pingu@layer{background}[]
+\pingu@block[rounded corners=\pingu@x@conicalhat@rounding]{\pingu@x@conicalhat@shade} (0,-.22cm)++(180:{\pingu@x@conicalhat@width/2+.05mm} and 1mm) coordinate (@) arc (180:360:{\pingu@x@conicalhat@width/2+.05mm} and 1mm) -- ++(.15mm,.3mm) to[bend right=5] ++(-\pingu@x@conicalhat@width/2, \pingu@x@conicalhat@height-.025cm) to[bend right=5] ([xshift=-.15mm,yshift=.3mm]@) -- cycle;
+\endpingu@layer
+
+\pingu@block[rounded corners=\pingu@x@conicalhat@rounding]{\pingu@color@conicalhat} (0,-.25cm)++(180:\pingu@x@conicalhat@width/2 and 1mm) coordinate (@) arc (180:0:\pingu@x@conicalhat@width/2 and 1mm) -- ++(.225mm,.6mm) to[bend right=5] ++(-\pingu@x@conicalhat@width/2, \pingu@x@conicalhat@height) to[bend right=5] ([xshift=-.225mm,yshift=.6mm]@) -- cycle;
+\endscope
+} \ No newline at end of file