diff options
author | Karl Berry <karl@freefriends.org> | 2009-04-18 16:42:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-04-18 16:42:44 +0000 |
commit | 9fbcb733dd11b3c8375ec9997391296abbc6d79d (patch) | |
tree | 7c139328d5c1b332a5a5311bebd0bf665d18b11c /Master/texmf-dist/tex/latex/circuitikz/pgfcirctripoles.sty | |
parent | 6e3c22d01092e6a41b9147068d2719a44d5ac16f (diff) |
new pgf package circuitikz (17apr09)
git-svn-id: svn://tug.org/texlive/trunk@12745 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/circuitikz/pgfcirctripoles.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/circuitikz/pgfcirctripoles.sty | 749 |
1 files changed, 749 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcirctripoles.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcirctripoles.sty new file mode 100644 index 00000000000..641dd0c40e6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcirctripoles.sty @@ -0,0 +1,749 @@ +% Copyright 2007-2009 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Tripoles + + + +\newcommand{\pgfcircdeclarelogicport}[2]{ + \pgfdeclareshape{#1 port} + { + \savedanchor\northwest{% + \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1 port/height}\pgf@y + \pgf@y=.5\pgf@y + \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1 port/width}\pgf@x + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \north + \pgf@y=-\pgf@y + } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOne{% + \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1 port/height}\pgf@y + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1 port/input height}\pgf@y + \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1 port/width}\pgf@x + \pgf@x=.5\pgf@x + } + \anchor{in 1}{ + \inOne + } + \anchor{in 2}{ + \inOne + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \northwest + \pgf@y=0pt + \pgf@x=-.8\pgf@x + } + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + #2 + + } + } +} + + +\pgfcircdeclarelogicport{and}{ + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@down}} + \pgfpathcurveto + {\pgfpoint{.0\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@right} + {.5\pgf@circ@res@down}} + {\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@right} + {0pt}} + \pgfpathcurveto + {\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@right} + {.5\pgf@circ@res@up}} + {\pgfpoint{.0\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + \pgfusepath{draw} +} + + + +\pgfcircdeclarelogicport{nand}{ + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{2\pgflinewidth} + + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/port width}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathcurveto + {\pgfpoint{.0\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{.5\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{.5\pgf@circ@res@up}} + {\pgfpoint{.0\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other-.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgfusepath{draw} +} + + +\pgfcircdeclarelogicport{nor}{ + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/port width}\pgf@circ@res@right + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/circle width}\pgf@circ@res@right + + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other-.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgfusepath{draw} +} + + + + +\pgfcircdeclarelogicport{or}{ + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/port width}\pgf@circ@res@right + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/aaa}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/aaa}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ddd}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ddd}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + + +\pgfcircdeclarelogicport{xor}{ + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/port width}\pgf@circ@res@right + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + + \def\pgf@circ@temp{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/distance}\pgf@circ@res@right+} + \pgfpathmoveto{\pgfpoint{\pgf@circ@temp-\pgf@circ@res@other}{\pgf@circ@res@up}} + + \pgfpathcurveto + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/aaa}\pgf@circ@res@left}{.95*\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/aaa}\pgf@circ@res@left}{.95*\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@temp-\pgf@circ@res@other}{.95*\pgf@circ@res@down}} + + \pgfusepath{draw} +} + + + +\pgfcircdeclarelogicport{xnor}{ + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/port width}\pgf@circ@res@right + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/circle width}\pgf@circ@res@right + + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + + \def\pgf@circ@temp{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/distance}\pgf@circ@res@right+} + \pgfpathmoveto{\pgfpoint{\pgf@circ@temp-\pgf@circ@res@other}{\pgf@circ@res@up}} + + \pgfpathcurveto + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/aaa}\pgf@circ@res@left}{.95*\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/aaa}\pgf@circ@res@left}{.95*\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@temp-\pgf@circ@res@other}{.95*\pgf@circ@res@down}} + + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other-.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgfusepath{draw} +} + + + + + +\newcommand{\pgfcircdeclaretransistor}[3]{ + \pgfdeclareshape{#1} + { + \anchor{center}{\pgfpointorigin} + \savedanchor\north{% + \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/height}\pgf@y + \pgf@y=.5\pgf@y + \pgf@x=0pt + } + \anchor{south}{ + \north + \pgf@y=-\pgf@y + } + \savedanchor\left{% + \pgf@y=0pt + \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/width}\pgf@x + } + #2 + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \north + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = \pgf@x + \left + \pgf@circ@res@left = \pgf@x + + #3 + + } + } +} + + + + + + +\newcommand{\pgfcircdeclaremos}[3]{ + \pgfcircdeclaretransistor{#1}{ + \anchor{G}{ + \left + } + \anchor{gate}{ + \left + } + \anchor{B}{ + \left + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@x + } + \anchor{base}{ + \left + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@x + } + #2 + } + {#3} +} + + + + + + + + + +\pgfcircdeclaremos{nmos}{ + \anchor{D}{ + \north + } + \anchor{drain}{ + \north + } + \anchor{S}{ + \north + \pgf@y=-\pgf@y + } + \anchor{source}{ + \north + \pgf@y=-\pgf@y + } +}{% + \pgfmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@down}} + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfsetlinewidth{2\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} +} + + +\pgfcircdeclaremos{pmos}{ + \anchor{S}{ + \north + } + \anchor{source}{ + \north + } + \anchor{D}{ + \north + \pgf@y=-\pgf@y + } + \anchor{drain}{ + \north + \pgf@y=-\pgf@y + } +}{% + \pgfmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{2\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} +} + + + + + + + +\pgfcircdeclaretransistor{pnp}{ + \anchor{E}{ + \north + } + \anchor{emitter}{ + \north + } + \anchor{B}{ + \left + } + \anchor{base}{ + \left + } + \anchor{C}{ + \north + \pgf@y=-\pgf@y + } + \anchor{collector}{ + \north + \pgf@y=-\pgf@y + } +}{ + \pgfmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/base height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{2\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height 2}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height 2}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + + +} + + + + + + +\pgfcircdeclaretransistor{npn}{ + \anchor{C}{ + \north + } + \anchor{collector}{ + \north + } + \anchor{B}{ + \left + } + \anchor{base}{ + \left + } + \anchor{E}{ + \north + \pgf@y=-\pgf@y + } + \anchor{emitter}{ + \north + \pgf@y=-\pgf@y + } +}{ + \pgfmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/base height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{2\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height 2}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + + +} + + +\endinput |