-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaudioicons.sty
133 lines (105 loc) · 4.01 KB
/
audioicons.sty
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
\ProvidesPackage{audioicons}
\RequirePackage{tikz}
\usetikzlibrary{calc}
\makeatletter
% Microphone ------------------------------------------------------------------
\tikzset{membrane style/.initial={}}
\pgfdeclareshape{basic microphone}{
\inheritsavedanchors[from=circle]
\inheritanchorborder[from=circle]
\inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{south}
\inheritanchor[from=circle]{west}
\inheritanchor[from=circle]{north}
\inheritanchor[from=circle]{east}
\inheritbackgroundpath[from=circle]
\beforebackgroundpath{
\pgfkeys{/tikz/membrane style/.get=\tmp}
\expandafter\tikzset\expandafter{\tmp}
\tikz@options
\setlength{\pgf@xa}{\radius}
\centerpoint \pgf@xb=\pgf@x \pgf@yb=\pgf@y
\pgfpathmoveto{\pgfpoint{\pgf@xb -\pgf@xa}{\pgf@yb +\pgf@xa}}
\pgfpathlineto{\pgfpoint{\pgf@xb -\pgf@xa}{\pgf@yb - \pgf@xa}}
\pgfusepath{stroke,fill}
}
}
% Loudspeaker -----------------------------------------------------------------
\tikzset{relative cone width/.initial={1}}
\tikzset{relative cone height/.initial={2}}
\pgfdeclareshape{basic loudspeaker}{
\inheritsavedanchors[from=rectangle]
\inheritanchorborder[from=rectangle]
\inheritanchor[from=rectangle]{center}
\inheritanchor[from=rectangle]{south}
\inheritanchor[from=rectangle]{west}
\inheritanchor[from=rectangle]{north}
\inheritanchor[from=rectangle]{east} % <- unklar, da sitzt der Cone
\backgroundpath{
\pgfkeys{/tikz/relative cone width/.get=\tmp}
\pgfmathsetlength \pgf@xc{\tmp*\pgfshapeminwidth}
\pgfkeys{/tikz/relative cone height/.get=\tmp}
\pgfmathsetlength \pgf@yc{0.5*(\tmp-1)*\pgfshapeminheight}
\northeast \pgf@xa=\pgf@x \pgf@ya=\pgf@y
\southwest \pgf@xb=\pgf@x \pgf@yb=\pgf@y
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
\pgfpathlineto{\pgfpoint{\pgf@xa + \pgf@xc}{\pgf@ya + \pgf@yc}}
\pgfpathlineto{\pgfpoint{\pgf@xa + \pgf@xc}{\pgf@yb - \pgf@yc}}
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@ya}}
\pgfpathclose
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
\pgfusepath{stroke,fill}
}
}
% Listener --------------------------------------------------------------------
\pgfdeclareshape{basic listener}{
\inheritsavedanchors[from=circle]
\inheritanchorborder[from=circle]
\inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{south}
\inheritanchor[from=circle]{west}
\inheritanchor[from=circle]{north}
\inheritanchor[from=circle]{east}
\inheritbackgroundpath[from=circle]
\beforebackgroundpath
{
\setlength{\pgf@xa}{\radius}
\centerpoint \pgf@xb=\pgf@x \pgf@yb=\pgf@y
\pgfpathmoveto{\pgfpoint{\pgf@xb -.4\pgf@xa}{\pgf@yb}}
\pgfpatharc{0}{360}{.1\pgf@xa}
\pgfpathmoveto{\pgfpoint{\pgf@xb +.4\pgf@xa}{\pgf@yb}}
\pgfpatharc{180}{-180}{.1\pgf@xa}
\pgfpathmoveto{\pgfpoint{\pgf@xb}{\[email protected]\pgf@xa}}
\pgfpatharc{270}{300}{.8\pgf@xa}
\pgfpathmoveto{\pgfpoint{\pgf@xb}{\[email protected]\pgf@xa}}
\pgfpatharc{270}{240}{.8\pgf@xa}
\pgfusepath{stroke}
}
}
% Plane wave --------------------------------------------------------------------
\pgfdeclareshape{plane wave}{
\inheritsavedanchors[from=rectangle]
\inheritanchorborder[from=rectangle]
\inheritanchor[from=rectangle]{center}
\inheritanchor[from=rectangle]{south}
\inheritanchor[from=rectangle]{west}
\inheritanchor[from=rectangle]{north}
\inheritanchor[from=rectangle]{east}
\backgroundpath{
\pgfpathmoveto{\pgfpoint{-10}{-25}}
\pgfpathlineto{\pgfpoint{-10}{25}}
\pgfpathmoveto{\pgfpoint{0}{-25}}
\pgfpathlineto{\pgfpoint{0}{25}}
\pgfpathmoveto{\pgfpoint{10}{-25}}
\pgfpathlineto{\pgfpoint{10}{25}}
\pgfpathmoveto{\pgfpoint{-15}{0}}
\pgfpathlineto{\pgfpoint{30}{0}}
\pgfsetarrowsstart{}
\pgfsetarrowsend{latex}
\pgfusepath{stroke}
}
}
\makeatother