\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: 
