% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-pdf.def,v 1.8 2007/12/17 14:52:31 tantau Exp $


% Common driver commands for all drivers that produce pdf

% Path construction:
\def\pgfsys@lineto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{l}}
\def\pgfsys@moveto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{m}}
\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{c}}
\def\pgfsys@rect#1#2#3#4{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgf@sys@bp{#3}\pgf@sys@bp{#4}\pgfsysprotocol@literal{re}}
\def\pgfsys@closepath{\pgfsysprotocol@literal{h}}

% Path usage:
\def\pgfsys@stroke{\pgfsysprotocol@literal{S}}
\def\pgfsys@closestroke{\pgfsysprotocol@literal{s}}
\def\pgfsys@fill{\ifpgfsys@eorule\pgfsysprotocol@literal{f*}\else\pgfsysprotocol@literal{f}\fi}
\def\pgfsys@fillstroke{\ifpgfsys@eorule\pgfsysprotocol@literal{B*}\else\pgfsysprotocol@literal{B}\fi}
\def\pgfsys@clipnext{\ifpgfsys@eorule\pgfsysprotocol@literal{W*}\else\pgfsysprotocol@literal{W}\fi}
\def\pgfsys@discardpath{\pgfsysprotocol@literal{n}}

% Transformation:
\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{cm}}

% Scopes
\def\pgfsys@beginscope{\pgfsysprotocol@literal{q}}
\def\pgfsys@endscope{\pgfsysprotocol@literal{Q}}

% Graphics state
\def\pgfsys@setdash#1#2{%
  \pgfsysprotocol@literalbuffered{[}%
  \pgfutil@for\pgf@sys@temp:={#1}\do{\pgf@sys@bp{\pgf@sys@temp}}%
  \pgfsysprotocol@literalbuffered{]}%
  \pgf@sys@bp{#2}\pgfsysprotocol@literal{d}}
\def\pgfsys@setlinewidth#1{\pgf@sys@bp{#1}\pgfsysprotocol@literal{w}}
\def\pgfsys@setmiterlimit#1{\pgfsysprotocol@literal{#1 M}}
\def\pgfsys@buttcap{\pgfsysprotocol@literal{0 J}}
\def\pgfsys@roundcap{\pgfsysprotocol@literal{1 J}}
\def\pgfsys@rectcap{\pgfsysprotocol@literal{2 J}}
\def\pgfsys@miterjoin{\pgfsysprotocol@literal{0 j}}
\def\pgfsys@roundjoin{\pgfsysprotocol@literal{1 j}}
\def\pgfsys@beveljoin{\pgfsysprotocol@literal{2 j}}
\def\pgfsys@color@rgb@stroke#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 RG}}
\def\pgfsys@color@rgb@fill#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 rg}}
\def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgfsysprotocol@literal{#1 #2 #3 #4 K}}
\def\pgfsys@color@cmyk@fill#1#2#3#4{\pgfsysprotocol@literal{#1 #2 #3 #4 k}}
\def\pgfsys@color@cmy@stroke#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 0 K}}
\def\pgfsys@color@cmy@fill#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 0 k}}
\def\pgfsys@color@gray@stroke#1{\pgfsysprotocol@literal{#1 G}}
\def\pgfsys@color@gray@fill#1{\pgfsysprotocol@literal{#1 g}}

% Opacity
\def\pgf@sys@pdf@addtopageresources@extgs#1{\pgf@sys@fail{adding to page resources}}
\def\pgf@sys@pdf@readdtopageresources@extgs#1{}% not always used
\def\pgfsys@stroke@opacity#1{%
  \expandafter\ifx\csname pgf@sys@pdf@so@#1\endcsname\relax%
    % Hmm... define...
    \expandafter\gdef\csname pgf@sys@pdf@so@#1\endcsname{/pgf@CA#1}%
    \pgf@sys@pdf@addtopageresources@extgs{/pgf@CA#1 << /CA #1 >>}%
  \else%
    \pgf@sys@pdf@readdtopageresources@extgs{/pgf@CA#1 << /CA #1 >>}%
  \fi%
  \pgfsysprotocol@literal{\csname pgf@sys@pdf@so@#1\endcsname\space gs}%  
}
\def\pgfsys@fill@opacity#1{%
  \expandafter\ifx\csname pgf@sys@pdf@fo@#1\endcsname\relax%
    % Hmm... define...
    \expandafter\gdef\csname pgf@sys@pdf@fo@#1\endcsname{/pgf@ca#1}%
    \pgf@sys@pdf@addtopageresources@extgs{/pgf@ca#1 << /ca #1 >>}%
  \else%
    \pgf@sys@pdf@readdtopageresources@extgs{/pgf@ca#1 << /ca #1 >>}%
  \fi%
  \pgfsysprotocol@literal{\csname pgf@sys@pdf@fo@#1\endcsname\space gs}%  
}


\endinput


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