summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def
blob: 3847d14a6c8b79502b340cc543569df463a752fd (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
% 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-dvips.def,v 1.23 2013/07/16 16:03:13 tantau Exp $

% Driver commands for dvips

\def\pgfsys@invoke#1{\special{ps:: #1}}
\def\pgfsys@outerinvoke#1{\special{ps: #1}}
\def\pgf@sys@postscript@header#1{\pgfutil@insertatbegincurrentpage{\special{! #1}}}
\def\pgf@sys@postscript@object#1{\special{! #1}}


%
% Load common postscript commands:
%
\input pgfsys-common-postscript.def


%
% dvips-specific stuff:
%

\def\pgfsys@beginpicture{\special{ps: }\special{ps::[begin]}\pgfsys@invoke{pgfo}}
\def\pgfsys@endpicture{\pgfsys@invoke{pgfc}\special{ps::[end]}}
\def\pgfsys@hbox#1{%
  \pgfsys@invoke{pgfs}%
    \special{ps::[end]}%
      \wd#1=0pt%
      \ht#1=0pt%
      \dp#1=0pt%
      \box#1
    \special{ps::[begin]}%
  \pgfsys@invoke{pgfr}%
}
\def\pgfsys@begininvisible{%
  \special{ps::[begin]}%
  \pgfsys@invoke{gsave nulldevice}%
  \special{ps::[end]}}
\def\pgfsys@endinvisible{%
  \special{ps::[begin]}%
  \pgfsys@invoke{grestore}%
  \special{ps::[end]}%
}
\def\pgfsys@color@unstacked#1{\special{ps: \XC@usecolor{#1}}}
\def\pgfsys@imagesuffixlist{.epsi:.eps:.ps:}

\def\pgfsys@papersize#1#2{%
  \special{papersize=#1,#2}%
}%  \expandafter\gdef\expandafter\pgfsys@atbegindocument\expandafter{\pgfsys@atbegindocument\special{papersize=#1,#2}}}

\expandafter\gdef\expandafter\pgfsys@atbegindocument\expandafter{\pgfsys@atbegindocument%
  \pgf@sys@postscript@header{
    /pgfsc{}bind def% stroke color is empty by default
    /pgffc{}bind def% fill color is empty by default
    /pgfstr{stroke}bind def%
    /pgffill{fill}bind def%
    /pgfeofill{eofill}bind def%
    /pgfe{a dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath}bind def% rectangle
    /pgfw{setlinewidth}bind def% setlinewidth
    /pgfs{save pgfpd 72 Resolution div 72 VResolution div neg scale 
      magscale{1 DVImag div dup scale}if 
      pgfx neg pgfy neg translate pgffoa .setopacityalpha}bind def% save
    /pgfr{pgfsd restore}bind def %restore
    userdict begin%
    /pgfo{pgfsd /pgfx currentpoint /pgfy exch def def @beginspecial}bind def %open
    /pgfc{newpath @endspecial pgfpd}bind def %close
    /pgfsd{globaldict /pgfdelta /delta where {pop delta} {0} ifelse put}bind def% save delta
    /pgfpd{/delta globaldict /pgfdelta get def}bind def % put delta
    /.setopacityalpha where {pop} {/.setopacityalpha{pop}def} ifelse % install .setopacityalpha 
    /.pgfsetfillopacityalpha{/pgffoa exch def
      /pgffill{gsave pgffoa .setopacityalpha fill 1 .setopacityalpha newpath fill grestore newpath}bind def
      /pgfeofill{gsave pgffoa .setopacityalpha eofill 1 .setopacityalpha newpath eofill grestore newpath}bind def}bind def
    /.pgfsetstrokeopacityalpha{/pgfsoa exch def /pgfstr{gsave pgfsoa .setopacityalpha stroke grestore newpath}bind def}bind def
    /pgffoa 1 def
    /pgfsoa 1 def
    end
  }%
}

\AtBeginDocument{ % needed for plain TeX
  \pgfsys@atbegindocument
  \let\pgfsys@atbegindocument=\pgfutil@empty
}



%
% Position tracking (needs pdftex >= 1.40 in dvi mode)
%
\ifx\pdftexversion\@undefined
\else
  \ifnum\pdftexversion>139

\def\pgfsys@markposition#1{%
  \pdfsavepos%
  \edef\pgf@temp{#1}%
  \expandafter\pgfutil@writetoaux\expandafter{%
    \expandafter\noexpand\expandafter\pgfsyspdfmark\expandafter{\pgf@temp}{\the\pdflastxpos}{\the\pdflastypos}}%
}

\def\pgfsyspdfmark#1#2#3{%
  \expandafter\gdef\csname pgf@sys@pdf@mark@pos@#1\endcsname{\pgfqpoint{#2sp}{#3sp}}%
}

\def\pgfsys@getposition#1#2{%
  \edef\pgf@marshal{\let\noexpand#2=\expandafter\noexpand\csname pgf@sys@pdf@mark@pos@#1\endcsname}%
  \pgf@marshal%
}

\def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfpointorigin}

  \fi
\fi

\endinput

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