Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. makeatletter
  2.  
  3. % Magnitude Comparator (magn comparator) shape
  4. pgfdeclareshape{magn comparator}
  5. {
  6. % The 'minimum width' and 'minimum height' keys, not the content, determine
  7. % the size
  8. savedanchornortheast
  9. {%
  10. pgfmathsetlengthpgf@x{pgfshapeminwidth}%
  11. pgfmathsetlengthpgf@y{pgfshapeminheight}%
  12. pgf@x=0.5pgf@x
  13. pgf@y=0.5pgf@y
  14. }
  15. % This is redundant, but makes some things easier:
  16. savedanchorsouthwest
  17. {%
  18. pgfmathsetlengthpgf@x{pgfshapeminwidth}%
  19. pgfmathsetlengthpgf@y{pgfshapeminheight}%
  20. pgf@x=-0.5pgf@x
  21. pgf@y=-0.5pgf@y
  22. }
  23. % Inherit from rectangle
  24. inheritanchorborder[from=rectangle]
  25.  
  26. % Define same anchor a normal rectangle has
  27. anchor{center}{pgfpointorigin}
  28. anchor{north}{northeast pgf@x=0pt}
  29. anchor{east}{northeast pgf@y=0pt}
  30. anchor{south}{southwest pgf@x=0pt}
  31. anchor{west}{southwest pgf@y=0pt}
  32. anchor{north east}{northeast}
  33. anchor{north west}{northeast pgf@x=-pgf@x}
  34. anchor{south west}{southwest}
  35. anchor{south east}{southwest pgf@x=-pgf@x}
  36. anchor{text}
  37. {
  38. pgfpointorigin
  39. advancepgf@x by -.5wdpgfnodeparttextbox%
  40. advancepgf@y by -.5htpgfnodeparttextbox%
  41. advancepgf@y by +.5dppgfnodeparttextbox%
  42. }
  43.  
  44. % Define anchors for input signal ports
  45. anchor{input gt}
  46. {
  47. pgf@process{southwest}%
  48. pgf@y=-.5pgf@y%
  49. }
  50. anchor{input eq}
  51. {
  52. pgf@process{southwest}%
  53. pgf@y=0pt%
  54. }
  55. anchor{input lt}
  56. {
  57. pgf@process{southwest}%
  58. pgf@y=.5pgf@y%
  59. }
  60. anchor{input a}
  61. {
  62. pgf@process{northeast}%
  63. pgf@x=-.3pgf@x%
  64. }
  65. anchor{input b}
  66. {
  67. pgf@process{northeast}%
  68. pgf@x=.3pgf@x%
  69. }
  70.  
  71. % Define anchors for output signal ports
  72. anchor{output gt}
  73. {
  74. pgf@process{northeast}%
  75. pgf@y=.5pgf@y%
  76. }
  77. anchor{output eq}
  78. {
  79. pgf@process{northeast}%
  80. pgf@y=0pt%
  81. }
  82. anchor{output lt}
  83. {
  84. pgf@process{northeast}%
  85. pgf@y=-.5pgf@y%
  86. }
  87.  
  88. % Draw the rectangle box and the port labels
  89. backgroundpath
  90. {
  91. % Rectangle box
  92. pgfpathrectanglecorners{southwest}{northeast}
  93. % node [and gate] (kek) at (0, 0) {};
  94. }
  95. }
  96.  
  97. % Define default style for this node
  98. tikzset
  99. {
  100. every magn comparator node/.style =
  101. {
  102. draw,
  103. minimum width = 2cm,
  104. minimum height = 2cm,
  105. thick,
  106. inner sep = 1mm,
  107. outer sep = 0pt,
  108. cap = round
  109. }
  110. }
  111.  
  112. makeatother
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement