\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-postscript.def,v 1.6 2005/10/18 18:03:38 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.




% Driver commands for postscript

\newif\ifpgf@fillcolor
\newif\ifpgf@strokecolor
\newif\ifpgfsys@@clipnext

% Path construction:
\def\pgfsys@lineto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{lineto}}
\def\pgfsys@moveto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{moveto}}
\def\pgfsys@curveto#1#2#3#4#5#6{%
  \pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgf@sys@bp{#3}\pgf@sys@bp{#4}\pgf@sys@bp{#5}\pgf@sys@bp{#6}\pgfsysprotocol@literal{curveto}}
\def\pgfsys@rect#1#2#3#4{\pgf@sys@bp{#4}\pgf@sys@bp{#3}\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{pgfe}}
\def\pgfsys@closepath{\pgfsysprotocol@literal{closepath}}

% Path usage:
\def\pgfsys@stroke{%
  \ifpgfsys@@clipnext%
    \ifpgfsys@eorule%
      \pgfsysprotocol@literal{gsave pgfsc pgfstr grestore eoclip newpath}%
    \else%
      \pgfsysprotocol@literal{gsave pgfsc pgfstr grestore clip newpath}%
    \fi%
    \pgfsys@@clipnextfalse%
  \else%
    \ifpgf@strokecolor%
      \pgfsysprotocol@literal{gsave pgfsc pgfstr grestore newpath}%
    \else%
      \pgfsysprotocol@literal{pgfstr}%
    \fi%
 \fi}
\def\pgfsys@fill{%
  \ifpgfsys@@clipnext%
    \ifpgfsys@eorule%
      \pgfsysprotocol@literal{gsave pgffc pgfeofill grestore eoclip newpath}%
    \else%
      \pgfsysprotocol@literal{gsave pgffc pgffill grestore clip newpath}%
    \fi%
    \pgfsys@@clipnextfalse%
  \else%
    \ifpgf@fillcolor%
      \ifpgfsys@eorule%
        \pgfsysprotocol@literal{gsave pgffc pgfeofill grestore newpath}%
      \else%
        \pgfsysprotocol@literal{gsave pgffc pgffill grestore newpath}%
      \fi%
    \else%
      \ifpgfsys@eorule%
        \pgfsysprotocol@literal{pgfeofill}%
      \else%
        \pgfsysprotocol@literal{pgffill}%
      \fi%
    \fi%
 \fi}
\def\pgfsys@fillstroke{%
  \ifpgfsys@eorule%
    \pgfsysprotocol@literal{gsave pgffc pgfeofill grestore gsave pgfsc pgfstr grestore}%
  \else%
    \pgfsysprotocol@literal{gsave pgffc pgffill grestore gsave pgfsc pgfstr grestore}%
  \fi%
  \ifpgfsys@@clipnext%
    \ifpgfsys@eorule%
      \pgfsysprotocol@literal{eoclip}%
    \else%
      \pgfsysprotocol@literal{clip}%
    \fi%
    \pgfsys@@clipnextfalse%
  \fi%
  \pgfsysprotocol@literal{newpath}}
\def\pgfsys@clipnext{\pgfsys@@clipnexttrue}
\def\pgfsys@discardpath{%
  \ifpgfsys@@clipnext%
    \ifpgfsys@eorule%
      \pgfsysprotocol@literal{eoclip}%
    \else%
      \pgfsysprotocol@literal{clip}%
    \fi%
    \pgfsys@@clipnextfalse%
  \fi%
  \pgfsysprotocol@literal{newpath}}

% Transformation:
\def\pgfsys@transformshift#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{translate}}
\def\pgfsys@transformxyscale#1#2{\pgfsysprotocol@literal{#1 #2 scale}}
\def\pgfsys@transformcm#1#2#3#4#5#6{%
  \pgfsysprotocol@literalbuffered{[#1 #2 #3 #4}\pgf@sys@bp{#5}\pgf@sys@bp{#6}\pgfsysprotocol@literal{] concat}}

% Scopes
\def\pgfsys@beginscope{\pgfsysprotocol@literal{save}}
\def\pgfsys@endscope{\pgfsysprotocol@literal{restore}}

% Graphics state
\def\pgfsys@setdash#1#2{%
  \pgfsysprotocol@literalbuffered{[}%
  \@for\pgf@sys@temp:={#1}\do{\pgf@sys@bp{\pgf@sys@temp}}%
  \pgfsysprotocol@literalbuffered{]}%
  \pgf@sys@bp{#2}\pgfsysprotocol@literal{setdash}}
\def\pgfsys@setlinewidth#1{\pgf@sys@bp{#1}\pgfsysprotocol@literal{pgfw}}
\def\pgfsys@setmiterlimit#1{\pgfsysprotocol@literal{#1 setmiterlimit}}
\def\pgfsys@buttcap{\pgfsysprotocol@literal{0 setlinecap}}
\def\pgfsys@roundcap{\pgfsysprotocol@literal{1 setlinecap}}
\def\pgfsys@rectcap{\pgfsysprotocol@literal{2 setlinecap}}
\def\pgfsys@miterjoin{\pgfsysprotocol@literal{0 setlinejoin}}
\def\pgfsys@roundjoin{\pgfsysprotocol@literal{1 setlinejoin}}
\def\pgfsys@beveljoin{\pgfsysprotocol@literal{2 setlinejoin}}
\def\pgfsys@color@rgb@stroke#1#2#3{\pgfsysprotocol@literal{/pgfsc{#1 #2 #3 setrgbcolor}def}\pgf@strokecolortrue}
\def\pgfsys@color@rgb@fill#1#2#3{\pgfsysprotocol@literal{/pgffc{#1 #2 #3 setrgbcolor}def}\pgf@fillcolortrue}
\def\pgfsys@color@rgb#1#2#3{\pgfsys@color@reset\pgfsysprotocol@literal{#1 #2 #3 setrgbcolor}}
\def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgfsysprotocol@literal{/pgfsc{#1 #2 #3 #4 setcmykcolor}def}\pgf@strokecolortrue}
\def\pgfsys@color@cmyk@fill#1#2#3#4{\pgfsysprotocol@literal{/pgffc{#1 #2 #3 #4 setcmykcolor}def}\pgf@fillcolortrue}
\def\pgfsys@color@cmyk#1#2#3#4{\pgfsys@color@reset\pgfsysprotocol@literal{#1 #2 #3 #4 setcmykcolor}}
\def\pgfsys@color@cmy@stroke#1#2#3{\pgfsysprotocol@literal{/pgfsc{#1 #2 #3 0 setcmykcolor}def}\pgf@strokecolortrue}
\def\pgfsys@color@cmy@fill#1#2#3{\pgfsysprotocol@literal{/pgffc{#1 #2 #3 0 setcmykcolor}def}\pgf@fillcolortrue}
\def\pgfsys@color@cmy#1#2#3{\pgfsys@color@reset\pgfsysprotocol@literal{#1 #2 #3 0 setcmykcolor}}
\def\pgfsys@color@gray@stroke#1{\pgfsysprotocol@literal{/pgfsc{#1 setgray}def}\pgf@strokecolortrue}
\def\pgfsys@color@gray@fill#1{\pgfsysprotocol@literal{/pgffc{#1 setgray}def}\pgf@fillcolortrue}
\def\pgfsys@color@gray#1{\pgfsys@color@reset\pgfsysprotocol@literal{#1 setgray}}
\def\pgfsysps@color@resetnow{\pgfsysprotocol@literal{/pgfsc{}def/pgffc{}def}\pgf@strokecolorfalse\pgf@fillcolorfalse}%
\def\pgfsys@color@reset{%
  \ifpgfsys@color@reset@inorder%
    \ifpgf@strokecolor%
      \pgfsysps@color@resetnow%
    \else%
      \ifpgf@fillcolor%
        \pgfsysps@color@resetnow%
      \fi%
    \fi%
  \else%
    \pgfsysps@color@resetnow%
  \fi}


% Opacity

\def\pgfsys@fill@opacity#1{%
  \pgfsysprotocol@literal{#1 .pgfsetfillopacityalpha}
}
\def\pgfsys@stroke@opacity#1{%
  \pgfsysprotocol@literal{#1 .pgfsetstrokeopacityalpha}
}

\endinput

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