Debian Codegraph @

texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex

raw
1 % Copyright 2018 by Till Tantau and others Wibrow
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 Public License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10
11
12 %
13 % Base shapes
14 %
15 % These shapes are identical to the shapes without "ee", only an "input"
16 % and an "output" anchor have been added at the left and right end.
17
18 \pgfdeclareshape{rectangle ee}
19 {%
20 \inheritsavedanchors[from=rectangle]%
21 \inheritanchorborder[from=rectangle]%
22 \inheritanchor[from=rectangle]{north}%
23 \inheritanchor[from=rectangle]{north west}%
24 \inheritanchor[from=rectangle]{north east}%
25 \inheritanchor[from=rectangle]{center}%
26 \inheritanchor[from=rectangle]{west}%
27 \inheritanchor[from=rectangle]{east}%
28 \inheritanchor[from=rectangle]{mid}%
29 \inheritanchor[from=rectangle]{mid west}%
30 \inheritanchor[from=rectangle]{mid east}%
31 \inheritanchor[from=rectangle]{base}%
32 \inheritanchor[from=rectangle]{base west}%
33 \inheritanchor[from=rectangle]{base east}%
34 \inheritanchor[from=rectangle]{south}%
35 \inheritanchor[from=rectangle]{south west}%
36 \inheritanchor[from=rectangle]{south east}%
37 \inheritbackgroundpath[from=rectangle]%
38 % New:
39 \anchor{input}{
40 \pgf@process{\northeast}%
41 \pgf@ya=.5\pgf@y%
42 \pgf@process{\southwest}%
43 \pgf@y=.5\pgf@y%
44 \advance\pgf@y by \pgf@ya%
45 }%
46 \anchor{output}{%
47 \pgf@process{\southwest}%
48 \pgf@ya=.5\pgf@y%
49 \pgf@process{\northeast}%
50 \pgf@y=.5\pgf@y%
51 \advance\pgf@y by \pgf@ya%
52 }%
53 }%
54
55 \pgfdeclareshape{circle ee}
56 {%
57 \inheritsavedanchors[from=circle]%
58 \inheritanchorborder[from=circle]%
59 \inheritanchor[from=circle]{north}%
60 \inheritanchor[from=circle]{north west}%
61 \inheritanchor[from=circle]{north east}%
62 \inheritanchor[from=circle]{center}%
63 \inheritanchor[from=circle]{west}%
64 \inheritanchor[from=circle]{east}%
65 \inheritanchor[from=circle]{mid}%
66 \inheritanchor[from=circle]{mid west}%
67 \inheritanchor[from=circle]{mid east}%
68 \inheritanchor[from=circle]{base}%
69 \inheritanchor[from=circle]{base west}%
70 \inheritanchor[from=circle]{base east}%
71 \inheritanchor[from=circle]{south}%
72 \inheritanchor[from=circle]{south west}%
73 \inheritanchor[from=circle]{south east}%
74 \inheritbackgroundpath[from=circle]%
75 % New:
76 \anchor{input}{\centerpoint\advance\pgf@x by-\radius}%
77 \anchor{output}{\centerpoint\advance\pgf@x by\radius}%
78 }%
79
80
81
82 %
83 % Current direction indicator. This shape uses the current setting of
84 % the current direction arrow tip for the arrow. The shape is a
85 % rectangle around the arrow tip.
86 %
87
88 \pgfdeclareshape{direction ee}
89 {%
90 \savedanchor\northeast{
91 \pgf@x=0pt%
92 % Height is given by minimum height/2
93 \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}%
94 \pgf@y=.5\pgf@y
95 }%
96 \savedanchor\southwest{
97 % Left border is given by left extend
98 \pgfarrowtotallength{\pgfkeysvalueof{/pgf/direction ee arrow}}%
99 \pgf@x=-\pgf@x%
100 % Height is given by minimum height/2
101 \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}%
102 \pgf@y=-.5\pgf@y
103 }%
104
105 \inheritanchor[from=rectangle ee]{center}%
106 \inheritanchor[from=rectangle ee]{north}%
107 \inheritanchor[from=rectangle ee]{south}%
108 \inheritanchor[from=rectangle ee]{east}%
109 \inheritanchor[from=rectangle ee]{west}%
110 \inheritanchor[from=rectangle ee]{north east}%
111 \inheritanchor[from=rectangle ee]{north west}%
112 \inheritanchor[from=rectangle ee]{south east}%
113 \inheritanchor[from=rectangle ee]{south west}%
114 \inheritanchor[from=rectangle ee]{input}%
115 \inheritanchor[from=rectangle ee]{output}%
116 \inheritanchorborder[from=rectangle ee]%
117 \nodeparts{}% no text
118
119 \behindbackgroundpath{
120 \pgf@process{\southwest}
121 \pgf@xa=\pgf@x
122 \pgf@process{\northeast}
123 \pgf@xb=\pgf@x
124 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
125 \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}
126 \pgfusepathqstroke
127 }%
128
129 \beforebackgroundpath{
130 {
131 \pgfsys@beginscope
132 \pgfarrowdraw{\pgfkeysvalueof{/pgf/direction ee arrow}}%
133 \pgfsys@endscope
134 }
135 }%
136 }%
137
138 \pgfkeys{
139 /pgf/direction ee arrow/.initial=direction ee,
140 }%
141
142
143
144 % Special arrow for ee directions:
145
146 \pgfarrowsdeclare{direction ee}{direction ee}
147 {%
148 \pgfmathsetlength\pgfutil@tempdima{\pgfgetarrowoptions{direction ee}}%
149 \pgfutil@tempdima=.5\pgfutil@tempdima
150 \pgfarrowsleftextend{+-\pgfutil@tempdima}
151 \pgfarrowsrightextend{+\pgfutil@tempdima}
152 }
153 {
154 \pgfmathsetlength\pgfutil@tempdima{\pgfgetarrowoptions{direction ee}}%
155 \pgfsetdash{}{+0pt}
156 \pgfsetroundjoin
157 \pgfpathmoveto{\pgfqpoint{-0.5\pgfutil@tempdima}{0.38268343237\pgfutil@tempdima}}
158 \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
159 \pgfpathlineto{\pgfqpoint{-0.5\pgfutil@tempdima}{-0.38268343237\pgfutil@tempdima}}
160 \pgfpathclose
161 \pgfusepathqfillstroke
162 }%
163
164 \pgfsetarrowoptions{direction ee}{4pt}%
165
166
167
168
169
170 \endinput