Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- makeatletter
- % Magnitude Comparator (magn comparator) shape
- pgfdeclareshape{magn comparator}
- {
- % The 'minimum width' and 'minimum height' keys, not the content, determine
- % the size
- savedanchornortheast
- {%
- pgfmathsetlengthpgf@x{pgfshapeminwidth}%
- pgfmathsetlengthpgf@y{pgfshapeminheight}%
- pgf@x=0.5pgf@x
- pgf@y=0.5pgf@y
- }
- % This is redundant, but makes some things easier:
- savedanchorsouthwest
- {%
- pgfmathsetlengthpgf@x{pgfshapeminwidth}%
- pgfmathsetlengthpgf@y{pgfshapeminheight}%
- pgf@x=-0.5pgf@x
- pgf@y=-0.5pgf@y
- }
- % Inherit from rectangle
- inheritanchorborder[from=rectangle]
- % Define same anchor a normal rectangle has
- anchor{center}{pgfpointorigin}
- anchor{north}{northeast pgf@x=0pt}
- anchor{east}{northeast pgf@y=0pt}
- anchor{south}{southwest pgf@x=0pt}
- anchor{west}{southwest pgf@y=0pt}
- anchor{north east}{northeast}
- anchor{north west}{northeast pgf@x=-pgf@x}
- anchor{south west}{southwest}
- anchor{south east}{southwest pgf@x=-pgf@x}
- anchor{text}
- {
- pgfpointorigin
- advancepgf@x by -.5wdpgfnodeparttextbox%
- advancepgf@y by -.5htpgfnodeparttextbox%
- advancepgf@y by +.5dppgfnodeparttextbox%
- }
- % Define anchors for input signal ports
- anchor{input gt}
- {
- pgf@process{southwest}%
- pgf@y=-.5pgf@y%
- }
- anchor{input eq}
- {
- pgf@process{southwest}%
- pgf@y=0pt%
- }
- anchor{input lt}
- {
- pgf@process{southwest}%
- pgf@y=.5pgf@y%
- }
- anchor{input a}
- {
- pgf@process{northeast}%
- pgf@x=-.3pgf@x%
- }
- anchor{input b}
- {
- pgf@process{northeast}%
- pgf@x=.3pgf@x%
- }
- % Define anchors for output signal ports
- anchor{output gt}
- {
- pgf@process{northeast}%
- pgf@y=.5pgf@y%
- }
- anchor{output eq}
- {
- pgf@process{northeast}%
- pgf@y=0pt%
- }
- anchor{output lt}
- {
- pgf@process{northeast}%
- pgf@y=-.5pgf@y%
- }
- % Draw the rectangle box and the port labels
- backgroundpath
- {
- % Rectangle box
- pgfpathrectanglecorners{southwest}{northeast}
- % node [and gate] (kek) at (0, 0) {};
- }
- }
- % Define default style for this node
- tikzset
- {
- every magn comparator node/.style =
- {
- draw,
- minimum width = 2cm,
- minimum height = 2cm,
- thick,
- inner sep = 1mm,
- outer sep = 0pt,
- cap = round
- }
- }
- makeatother
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement