-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgfx-components.sty
More file actions
82 lines (76 loc) · 3.61 KB
/
gfx-components.sty
File metadata and controls
82 lines (76 loc) · 3.61 KB
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
\ProvidesPackage{prettytex/gfx-components}
\RequirePackage{prettytex/gfx}
%----------------------------------------------------------------------------------------------------------------------
% generic flow component styles
%----------------------------------------------------------------------------------------------------------------------
\tikzset{bcomp/.style={draw,draw=blue,fill=blue!50,text=white}}
\tikzset{rcomp/.style={draw,draw=red,fill=red!70,text=white}}
\tikzset{gcomp/.style={draw,draw=green,fill=green!50,text=white}}
\tikzset{ocomp/.style={draw,draw=orange,fill=orange!50,text=white}}
\tikzset{pcomp/.style={draw,draw=purple,fill=purple!50,text=white}}
%----------------------------------------------------------------------------------------------------------------------
% dots
%----------------------------------------------------------------------------------------------------------------------
\tikzset{bdot/.style={blue,circle,draw,minimum size=5pt,inner sep=0pt,fill=blue!70}}
\tikzset{rdot/.style={red,circle,draw,minimum size=5pt,inner sep=0pt,fill=red!70}}
\tikzset{gdot/.style={green,circle,draw,minimum size=5pt,inner sep=0pt,fill=green!70}}
\tikzset{odot/.style={orange,circle,draw,minimum size=5pt, inner sep=0pt,fill=orange!70}}
\tikzset{pdot/.style={purple,circle,draw,minimum size=5pt, inner sep=0pt,fill=purple!70}}
%----------------------------------------------------------------------------------------------------------------------
% adder and multiplier
%----------------------------------------------------------------------------------------------------------------------
% node shape definition
\makeatletter
\pgfdeclareshape{poplus}
{
\inheritsavedanchors[from=circle]
\inheritanchorborder[from=circle]
\inheritanchor[from=circle]{north}
\inheritanchor[from=circle]{north west}
\inheritanchor[from=circle]{north east}
\inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{west}
\inheritanchor[from=circle]{east}
\inheritanchor[from=circle]{mid}
\inheritanchor[from=circle]{mid west}
\inheritanchor[from=circle]{mid east}
\inheritanchor[from=circle]{base}
\inheritanchor[from=circle]{base west}
\inheritanchor[from=circle]{base east}
\inheritanchor[from=circle]{south}
\inheritanchor[from=circle]{south west}
\inheritanchor[from=circle]{south east}
\inheritbackgroundpath[from=circle]
\foregroundpath{
\centerpoint%
\pgf@xc=\pgf@x%
\pgf@yc=\pgf@y%
\pgfutil@tempdima=\radius%
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xb<\pgf@yb%
\advance\pgfutil@tempdima by-\pgf@yb%
\else%
\advance\pgfutil@tempdima by-\pgf@xb%
\fi%
\pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{\pgfutil@tempdima}{0pt}}}
\pgfpathlineto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{-\pgfutil@tempdima}{0pt}}}
\pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{0pt}{-\pgfutil@tempdima}}}
\pgfpathlineto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}{\pgfqpoint{0pt}{\pgfutil@tempdima}}}
\pgfsetarrowsstart{}
\pgfsetarrowsend{}
}
}
\makeatother
% adder definitons
\tikzset{badd/.style={poplus,bcomp}}
\tikzset{radd/.style={poplus,rcomp}}
\tikzset{gadd/.style={poplus,gcomp}}
\tikzset{oadd/.style={poplus,ocomp}}
\tikzset{padd/.style={poplus,pcomp}}
% multiplier definitons
\tikzset{bmul/.style={poplus,bcomp,rotate=45}}
\tikzset{rmul/.style={poplus,rcomp,rotate=45}}
\tikzset{gmul/.style={poplus,gcomp,rotate=45}}
\tikzset{omul/.style={poplus,ocomp,rotate=45}}
\tikzset{pmul/.style={poplus,pcomp,rotate=45}}