summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex
blob: 1eecaf431e90acf53ae979091f6a4fc58f46bf46 (plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsyssoftpath.code.tex,v 1.1.1.1 2005/06/29 12:14:05 tantau Exp $

% Copyright 2005 by Till Tantau <tantau@cs.tu-berlin.de>.
%
% This program can be redistributed and/or modified under the terms
% of the GNU Public License, version 2.



% This package provides the pgf system path abstraction layer. This
% layer is used to construct paths first ``abstractly.'' These
% abstract paths can still be modified, before they are ``made
% concrete.'' 
%
% An abstract path consists of a sequence of basic building blocks,
% each of which is a tuple consisting of two numbers (specifying a
% coordinate) and a token. Possible tokens are:
%
% 1. moveto
% 2. lineto
% 3. rectcorner
% 4. rectsize
% 5. curvetosupporta
% 6. curvetosupportb
% 7. curveto
% 8. closepath
% 9. specialround
%
% A curveto must always be preceeded by a curvetosupporta and a
% curvetosupportb. A non-empty path must always begin with a
% moveto. The coordinates of a closepath are non-specified, currently, 
% but they might be set to the coordinate of the path segment start,
% in the future.



\let\pgfsyssoftpath@currentpath=\@empty
% The current path

\def\pgfsyssoftpath@lastmoveto{{0pt}{0pt}}

% Add a moveto element to the current path
\def\pgfsyssoftpath@moveto#1#2{%
  \edef\pgfsyssoftpath@temp{{%
    \noexpand\pgfsyssoftpath@movetotoken{#1}{#2}%
  }}%
  \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp%
  \xdef\pgfsyssoftpath@lastmoveto{{#1}{#2}}%
}

% Add a lineto element to the current path
\def\pgfsyssoftpath@lineto#1#2{%
  \edef\pgfsyssoftpath@temp{{%
    \noexpand\pgfsyssoftpath@linetotoken{#1}{#2}%
  }}%
 \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp%
}

% Add curveto elements to the current path
\def\pgfsyssoftpath@curveto#1#2#3#4#5#6{%
  \edef\pgfsyssoftpath@temp{{%
    \noexpand\pgfsyssoftpath@curvetosupportatoken{#1}{#2}%
    \noexpand\pgfsyssoftpath@curvetosupportbtoken{#3}{#4}%
    \noexpand\pgfsyssoftpath@curvetotoken{#5}{#6}%
  }}%
 \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp%
}

% Add rectanlge elements to the current path
\def\pgfsyssoftpath@rect#1#2#3#4{%
  \edef\pgfsyssoftpath@temp{{%
    \noexpand\pgfsyssoftpath@rectcornertoken{#1}{#2}%
    \noexpand\pgfsyssoftpath@rectsizetoken{#3}{#4}%
  }}%
 \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp%
}

% Add closepath element to the current path
\def\pgfsyssoftpath@closepath{%
  \edef\pgfsyssoftpath@temp{{%
    \noexpand\pgfsyssoftpath@closepathtoken\pgfsyssoftpath@lastmoveto%
  }}%
  \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp%
}

% Add special element to the current path
\def\pgfsyssoftpath@specialround#1#2{%
  \edef\pgfsyssoftpath@temp{{%
    \noexpand\pgfsyssoftpath@specialroundtoken{#1}{#2}%
  }}%
 \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp%
}


% Getting and setting the current path
\def\pgfsyssoftpath@getcurrentpath#1{%
  \let#1=\pgfsyssoftpath@currentpath%
}

\def\pgfsyssoftpath@setcurrentpath#1{%
  \global\let\pgfsyssoftpath@currentpath=#1%
}


% Invoking the current path
\def\pgfsyssoftpath@invokecurrentpath{%
  \pgfsyssoftpath@currentpath%
}

\def\pgfsyssoftpath@flushcurrentpath{%
  \pgfsyssoftpath@invokecurrentpath%
  \pgfsyssoftpath@setcurrentpath\@empty%
}

% Marshallers
\def\pgfsyssoftpath@movetotoken#1#2{\pgfsys@moveto{#1}{#2}}
\def\pgfsyssoftpath@linetotoken#1#2{\pgfsys@lineto{#1}{#2}}
\def\pgfsyssoftpath@rectcornertoken#1#2#3#4#5{\pgfsys@rect{#1}{#2}{#4}{#5}} % #3 = \pgfsyssoftpath@rectsizetoken
\def\pgfsyssoftpath@curvetosupportatoken#1#2#3#4#5#6#7#8{\pgfsys@curveto{#1}{#2}{#4}{#5}{#7}{#8}}
\def\pgfsyssoftpath@closepathtoken#1#2{\pgfsys@closepath}
\let\pgfsyssoftpath@specialroundtoken=\@gobbletwo


\endinput

%%% Local Variables: 
%%% mode: latex
%%% End: