diff options
author | Karl Berry <karl@freefriends.org> | 2008-02-24 18:22:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-02-24 18:22:07 +0000 |
commit | ac768be5ab2e638802806ac364ca4402e8e9935e (patch) | |
tree | bf26e0d972206f02cda2535e35dd8c2a33c04eaa /Master/texmf-dist/tex/generic/pgf/systemlayer | |
parent | bc195e7c0fe9d96cd9b6c0230da50da6fc28de26 (diff) |
pgf 2.0, third try
git-svn-id: svn://tug.org/texlive/trunk@6747 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/systemlayer')
14 files changed, 3477 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg new file mode 100644 index 00000000000..659b541c539 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg @@ -0,0 +1,25 @@ +% 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/pgf.cfg,v 1.6 2008/01/13 15:30:04 tantau Exp $ + +% Default driver: +\ifx\pgfsysdriver\@undefined + \edef\pgfsysdriver{pgfsys-\Gin@driver} +\fi + + +% Uncomment the following if you use dvipdfm and plain tex: +% \def\pgfsysdriver{pgfsys-dvipdfm.def} + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def new file mode 100644 index 00000000000..3a88a236de5 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def @@ -0,0 +1,92 @@ +% 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: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def new file mode 100644 index 00000000000..75d06305bb1 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def @@ -0,0 +1,425 @@ +% 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-postscript.def,v 1.18 2008/02/07 19:25:41 tantau Exp $ + + +% 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{[}% + \pgfutil@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} +} + +% Objects +\newcount\pgf@objectcount +\def\pgfsys@defobject#1#2#3#4{% + \global\advance\pgf@objectcount by 1% + \expandafter\xdef\csname#1\endcsname{\the\pgf@objectcount}% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + #4% + \pgfsysprotocol@getcurrentprotocol\pgfsys@@temp% + \pgf@sys@postscript@object{/pgf\csname#1\endcsname{gsave exec \pgfsys@@temp\space grestore} bind def}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp% +} +\def\pgfsys@useobject#1#2{% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedfalse% + #2% + \pgfsysprotocol@invokecurrentprotocol% + \pgfsys@invoke{pgf\csname#1\endcsname}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp} + +% Shadings + +\def\pgfsys@horishading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgfmathsetlength\pgf@x{#2}% + \pgf@xa=\pgf@x% + \pgf@sys@bp@correct{\pgf@x}% + \pgf@y=\pgf@max% + \pgf@sys@bp@correct{\pgf@y}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to \the\pgf@max{% + \noexpand\vrule width0pt height\the\pgf@xa% + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@rect{0pt}{0pt}{\the\pgf@max}{\the\pgf@xa}% + \noexpand\pgfsys@clipnext% + \noexpand\pgfsys@discardpath% + \noexpand\pgfsys@invoke{\pgf@domb\space \pgf@sys@tonumber{\pgf@x} pgfH \pgf@psfuncs\space pop}% + \hss% + \noexpand\pgfsys@endpurepicture}}% + }% +} +\def\pgfsys@vertshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgfmathsetlength\pgf@x{#2}% + \pgf@xa=\pgf@x% + \pgf@sys@bp@correct{\pgf@x}% + \pgf@y=\pgf@max% + \pgf@sys@bp@correct{\pgf@y}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to\the\pgf@xa{% + \noexpand\vrule width0pt height\the\pgf@max% + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@rect{0pt}{0pt}{\the\pgf@xa}{\the\pgf@max}% + \noexpand\pgfsys@clipnext% + \noexpand\pgfsys@discardpath% + \noexpand\pgfsys@invoke{\pgf@domb\space \pgf@sys@tonumber{\pgf@x} pgfV \pgf@psfuncs\space pop}% + \hss% + \noexpand\pgfsys@endpurepicture}}% + }% +} +\def\pgfsys@radialshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgf@process{#2}% + \pgf@sys@bp@correct{\pgf@x}% + \pgf@sys@bp@correct{\pgf@y}% + \pgf@xa=2\pgf@max% + \pgf@sys@bp@correct{\pgf@max}% + \advance\pgf@x by \pgf@max% + \advance\pgf@y by \pgf@max% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to \the\pgf@xa{% + \noexpand\vrule width0pt height\the\pgf@xa% + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@invoke{% + \pgf@domb\space \pgf@sys@tonumber{\pgf@y} \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@max} pgfR1 + \pgf@psfuncs\space \pgf@firstcolor\space \pgf@doma\space pgfR2}% + \hss% + \noexpand\pgfsys@endpurepicture}}% + }% +} +\def\pgfsys@functionalshading#1#2#3#4{% + {% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \pgf@sys@bp@correct{\pgf@xa}% + \pgf@sys@bp@correct{\pgf@ya}% + \pgf@sys@bp@correct{\pgf@xb}% + \pgf@sys@bp@correct{\pgf@yb}% + \pgf@xc=-\pgf@xa% + \pgf@yc=-\pgf@ya% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \hbox to\the\pgf@x{\vbox to\the\pgf@y{\vfil + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@invoke{% + \pgf@sys@tonumber{\pgf@xc} \pgf@sys@tonumber{\pgf@yc} translate + 1.1 setlinewidth [] 0 setdash 0 setlinecap + /pgfproc {#4} bind def + \pgf@sys@tonumber{\pgf@ya} 1 \pgf@sys@tonumber{\pgf@yb} + { + \pgf@sys@tonumber{\pgf@xa} 1 \pgf@sys@tonumber{\pgf@xb} + { 1 index 2 copy pgfproc setrgbcolor moveto 1.1 0 rlineto stroke } + for + } + for + }% + \noexpand\pgfsys@endpurepicture + }\hfil}% + }% + }% +} + +% +% Patterns +% + + +\def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{% + % Start building the pattern dictionary: + \pgf@xa=#2\relax% + \pgf@ya=#3\relax% + \pgf@xb=#4\relax% + \pgf@yb=#5\relax% + \pgf@xc=#6\relax% + \pgf@yc=#7\relax% + \pgf@sys@bp@correct\pgf@xa% + \pgf@sys@bp@correct\pgf@ya% + \pgf@sys@bp@correct\pgf@xb% + \pgf@sys@bp@correct\pgf@yb% + \pgf@sys@bp@correct\pgf@xc% + \pgf@sys@bp@correct\pgf@yc% + \pgfsys@outerinvoke{ + save true setglobal globaldict begin /pgfpat#1 + { + \ifnum#9=0 [/Pattern /DeviceRGB] \else /Pattern \fi\space + setcolorspace + gsave + initgraphics + << + /Type /Pattern + /PatternType 1 + /PaintType \ifnum#9=0 2 \else 1 \fi + /TilingType 1 + /BBox [\pgf@sys@tonumber\pgf@xa\space\pgf@sys@tonumber\pgf@ya\space\pgf@sys@tonumber\pgf@xb\space\pgf@sys@tonumber\pgf@yb] + /XStep \pgf@sys@tonumber\pgf@xc\space + /YStep \pgf@sys@tonumber\pgf@yc\space + /PaintProc + { begin 2 dict begin #8\space end end } bind + >> + matrix + makepattern + %/pgfpat#1\space exch def + grestore + setcolor + } bind def end restore + }% << +} + +\def\pgfsys@setpatternuncolored#1#2#3#4{% + \pgfsysprotocol@literal{/pgffc{#2 #3 #4 pgfpat#1}def}% +% [/Pattern /DeviceRGB] setcolorspace +% #2 #3 #4 pgfpat#1\space setcolor +% }def}% + \pgf@fillcolortrue% +} + +\def\pgfsys@setpatterncolored#1{% + \pgfsysprotocol@literal{/pgffc{pgfpat#1}def}%/Pattern setcolorspace +% pgfpat#1\space setcolor}def}% + \pgf@fillcolortrue% +} + + + +\def\pgfsys@atbegindocument{% + % Parameters to horizontal pre axishade: \pgf@domb x + \pgf@sys@postscript@header{/pgfH{% + /pgfheight exch def 0.75 setlinewidth [] 0 setdash + /pgfshade {pgfA} def /pgfdir { dup 0 moveto + dup 5 index lineto } bind def} bind def}% + + % Parameters to vertical pre axishade: \pgf@domb x + \pgf@sys@postscript@header{/pgfV{% + /pgfheight exch def 0.75 setlinewidth [] 0 setdash + /pgfshade {pgfA} def /pgfdir { dup 0 exch moveto dup 5 index + exch lineto } bind def} bind def}% + + % Parameters to axishade: end x, start x, r-, g-, b- of first color, r-, g-, b- of second color + % Stack afterwards: end x + \pgf@sys@postscript@header{/pgfA{ + /pgfdiff 8 index round cvi 8 index round cvi sub 2 mul 1 add def + 2 index 6 index sub pgfdiff div % put red-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + pgfheight 9 index 9 index 9 index 14 index + pgfdiff { + 3 index 3 index 3 index setrgbcolor % Set color + pgfdir + stroke + 4 -1 roll 7 index add % red += incred + 4 -1 roll 6 index add % green += incgreen + 4 -1 roll 5 index add % blue += incblue + 4 -1 roll .5 sub % x += 0.5 + } repeat + mark 15 1 roll cleartomark exch pop % leave only start x on stack + }bind def } + + % Parameters to radialshade pre: \pgf@domb y x max + \pgf@sys@postscript@header{/pgfR1{ + newpath dup dup dup 0 360 arc clip newpath + dup /pgfendx exch def + /pgfendy exch def + 0.875 setlinewidth + [] 0 setdash + /pgfshade {pgfR} def + /pgfstartx exch def + /pgfstarty exch def + /pgfdiffx pgfendx pgfstartx sub def + /pgfdiffy pgfendy pgfstarty sub def + dup /pgfdomb exch def + }bind def } + + % Parameters to radialshade post: \pgf@firstcolor \pgf@doma + \pgf@sys@postscript@header{/pgfR2{ + newpath 0.5 add pgfcircx pgfcircy 3 2 roll 0 360 arc + setrgbcolor fill pop}bind def }% + + % Parameters to radialshade: end x, start x, r-, g-, b- of first color, r-, g-, b- of second color + % Stack afterwards: end x + \pgf@sys@postscript@header{/pgfR{ + /pgfdiff 8 index round cvi 8 index round cvi sub 4 mul 1 add def + /pgfcircx pgfstartx 9 index pgfdiffx pgfdomb div mul add def + /pgfcircy pgfstarty 9 index pgfdiffy pgfdomb div mul add def + /pgfcircxe pgfstartx 8 index pgfdiffx pgfdomb div mul add def + /pgfcircye pgfstarty 8 index pgfdiffy pgfdomb div mul add def + /pgfxstep pgfcircxe pgfcircx sub pgfdiff div def + /pgfystep pgfcircye pgfcircy sub pgfdiff div def + 2 index 6 index sub pgfdiff div % put red-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + 8 index 8 index 8 index 13 index + pgfdiff { + 3 index 3 index 3 index setrgbcolor % Set color + pgfcircx pgfcircy 2 index 0 360 arc closepath + stroke + 4 -1 roll 6 index add % red += incred + 4 -1 roll 5 index add % green += incgreen + 4 -1 roll 4 index add % blue += incblue + 4 -1 roll .25 sub % x += 0.25 + /pgfcircx pgfcircx pgfxstep add def + /pgfcircy pgfcircy pgfystep add def + } repeat + mark 14 1 roll cleartomark exch pop % leave only start x on stack + }bind def} +} + + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def new file mode 100644 index 00000000000..fdf16a61210 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def @@ -0,0 +1,419 @@ +% 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-svg.def,v 1.20 2008/02/07 19:25:41 tantau Exp $ + + +% Driver commands for svg + + +% Helping functions: +\let\pgf@sys@svgpath=\pgfutil@empty +\def\pgf@sys@svgnum#1{% + {% + \pgf@x=#1\relax% + \edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}% + \toks@\expandafter\expandafter\expandafter{\expandafter\pgf@sys@svgpath\temp}% + \xdef\pgf@sys@svgpath{\the\toks@}% + }% +} +\def\pgf@sys@addtosvgpath#1{\pgfutil@g@addto@macro\pgf@sys@svgpath{#1\space}} +\def\pgf@sys@flushsvgpath{\pgfsysprotocol@literal{\pgf@sys@svgpath}\global\let\pgf@sys@svgpath=\pgfutil@empty} +\def\pgf@sys@svg@gs#1{% + {\pgfsysprotocol@literal{<g #1>\Hnewline }}\global\advance\pgf@sys@svg@scopecount by1\relax% +} +\newcount\pgf@sys@svg@objectcount +\let\Hnewline=\pgfutil@empty +\catcode`\%=12 +\def\pgf@sys@svg@percentchar{%} +\catcode`\%=14 + +% Path construction: +\def\pgfsys@lineto#1#2{\pgf@sys@addtosvgpath{L }\pgf@sys@svgnum{#1}\pgf@sys@svgnum{#2}} +\def\pgfsys@moveto#1#2{\pgf@sys@addtosvgpath{M }\pgf@sys@svgnum{#1}\pgf@sys@svgnum{#2}} +\def\pgfsys@curveto#1#2#3#4#5#6{% + \pgf@sys@addtosvgpath{C }% + \pgf@sys@svgnum{#1}\pgf@sys@svgnum{#2}% + \pgf@sys@svgnum{#3}\pgf@sys@svgnum{#4}% + \pgf@sys@svgnum{#5}\pgf@sys@svgnum{#6}} +\def\pgfsys@rect#1#2#3#4{% + \pgfsys@moveto{#1}{#2}% + \pgf@sys@addtosvgpath{h }\pgf@sys@svgnum{#3}% + \pgf@sys@addtosvgpath{v }\pgf@sys@svgnum{#4}% + \pgf@sys@addtosvgpath{h }{\pgf@x=#3\pgf@x=-\pgf@x\pgf@sys@svgnum{\pgf@x}}% + \pgfsys@closepath} +\def\pgfsys@closepath{\pgf@sys@addtosvgpath{Z}} + +% Path usage: +\newif\ifpgf@sys@svg@clipnext +\def\pgf@sys@svg@possiblyclippedpath#1{% + \ifpgf@sys@svg@clipnext% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgfsysprotocol@literal{<clipPath id="pgfcp\the\pgf@sys@svg@objectcount"> + <path id="pgfpath\the\pgf@sys@svg@objectcount" d="}% + \pgf@sys@flushsvgpath% + \pgfsysprotocol@literal{"/>\Hnewline </clipPath>\Hnewline } + \pgfsysprotocol@literal{<use xlink:href="\#pgfpath\the\pgf@sys@svg@objectcount" #1/>\Hnewline }% + \pgf@sys@svg@gs{clip-path="url(\#pgfcp\the\pgf@sys@svg@objectcount)"} + \pgf@sys@svg@clipnextfalse% + \else% + \pgfsysprotocol@literal{<path d="}% + \pgf@sys@flushsvgpath% + \pgfsysprotocol@literal{" #1/>\Hnewline } + \fi% +} +\def\pgfsys@stroke{\pgf@sys@svg@possiblyclippedpath{style="fill:none"}} +\def\pgfsys@fill{\pgf@sys@svg@possiblyclippedpath{style="stroke:none"}} +\def\pgfsys@fillstroke{\pgf@sys@svg@possiblyclippedpath{}} +\def\pgfsys@clipnext{\pgf@sys@svg@clipnexttrue} +\def\pgfsys@discardpath{% + \ifpgf@sys@svg@clipnext% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgfsysprotocol@literal{<clipPath id="pgfcp\the\pgf@sys@svg@objectcount"> + <path d="}% + \pgf@sys@flushsvgpath% + \pgfsysprotocol@literal{"/>\Hnewline </clipPath>\Hnewline } + \pgf@sys@svg@gs{clip-path="url(\#pgfcp\the\pgf@sys@svg@objectcount)"} + \pgf@sys@svg@clipnextfalse% + \else% + \global\let\pgf@sys@svgpath=\pgfutil@empty + \fi} + +% Fill rules: +\def\pgfsys@eoruletrue{\pgf@sys@svg@gs{fill-rule="evenodd"}} +\def\pgfsys@eorulefalse{\pgf@sys@svg@gs{fill-rule="nonzero"}} + +% Transparency: +\def\pgfsys@stroke@opacity#1{\pgf@sys@svg@gs{stroke-opacity="#1"}} +\def\pgfsys@fill@opacity#1{\pgf@sys@svg@gs{fill-opacity="#1"}} + +% Transformation: +\def\pgfsys@transformcm#1#2#3#4#5#6{% + {\pgf@x=#5\pgf@y=#6% + \pgf@sys@svg@gs{transform="matrix(#1,#2,#3,#4,\pgf@sys@tonumber{\pgf@x},\pgf@sys@tonumber{\pgf@y})"}}} + +% Scopes +\newcount\pgf@sys@svg@scopecount +\def\pgfsys@beginscope{% + \edef\pgf@sys@svg@thescopecount{\the\pgf@sys@svg@scopecount}% + \begingroup% + \pgf@sys@svg@scopecount=1\relax% + \pgfsysprotocol@literal{<g>\Hnewline }% + } +\def\pgfsys@endscope{% + \loop% + \pgfsysprotocol@literal{</g>\Hnewline }% + \advance\pgf@sys@svg@scopecount by-1\relax% + \ifnum\pgf@sys@svg@scopecount>0\relax% + \repeat% + \endgroup% + \global\pgf@sys@svg@scopecount=\pgf@sys@svg@thescopecount\relax% +} + +% Graphics state +\def\pgfsys@setdash#1#2{% + \edef\pgf@test@dashpattern{#1}% + \ifx\pgf@test@dashpattern\pgfutil@empty% + \pgf@sys@svg@gs{stroke-dasharray="none" stroke-dashoffset="#2"}% + \else% + \pgf@sys@svg@gs{stroke-dasharray="#1" stroke-dashoffset="#2"}% + \fi} +\def\pgfsys@setlinewidth#1{\pgf@sys@svg@gs{stroke-width="#1"}} +\def\pgfsys@setmiterlimit#1{\pgf@sys@svg@gs{stroke-miterlimit="#1"}} +\def\pgfsys@buttcap{\pgf@sys@svg@gs{stroke-linecap="butt"}} +\def\pgfsys@roundcap{\pgf@sys@svg@gs{stroke-linecap="round"}} +\def\pgfsys@rectcap{\pgf@sys@svg@gs{stroke-linecap="square"}} +\def\pgfsys@miterjoin{\pgf@sys@svg@gs{stroke-linejoin="miter"}} +\def\pgfsys@roundjoin{\pgf@sys@svg@gs{stroke-linejoin="round"}} +\def\pgfsys@beveljoin{\pgf@sys@svg@gs{stroke-linejoin="bevel"}} + + +% +% Color management +% + +\def\XC@mcolor{\ifpgfpicture\pgfsetcolor{.}\fi} + +\def\pgf@sys@svg@color@rgb#1,#2,#3\relax{% + {% + \pgf@xa=#1pt% + \pgf@xa=100\pgf@xa% + \pgf@xb=#2pt% + \pgf@xb=100\pgf@xb% + \pgf@xc=#3pt% + \pgf@xc=100\pgf@xc% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xb\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xc\pgf@sys@svg@percentchar)}% + }% +} +\def\pgf@sys@svg@color@cmy#1,#2,#3\relax{% + {% + \pgf@xa=1pt% + \advance\pgf@xa by-#1pt% + \pgf@xa=100\pgf@xa% + \pgf@xb=1pt% + \advance\pgf@xb by-#2pt% + \pgf@xb=100\pgf@xb% + \pgf@xc=1pt% + \advance\pgf@xc by-#3pt% + \pgf@xc=100\pgf@xc% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xb\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xc\pgf@sys@svg@percentchar)}% + }% +} +\def\pgf@sys@svg@color@cmyk#1,#2,#3,#4\relax{% + {% + \pgf@xa=1pt% + \advance\pgf@xa by-#4pt% + \pgf@xa=#1\pgf@xa% + \advance\pgf@xa by#4pt% + \advance\pgf@xa by-1pt% + \pgf@xa=-100\pgf@xa% + \pgf@xb=1pt% + \advance\pgf@xb by-#4pt% + \pgf@xb=#2\pgf@xb% + \advance\pgf@xb by#4pt% + \advance\pgf@xb by-1pt% + \pgf@xb=-100\pgf@xb% + \pgf@xc=1pt% + \advance\pgf@xc by-#4pt% + \pgf@xc=#3\pgf@xc% + \advance\pgf@xc by#4pt% + \advance\pgf@xc by-1pt% + \pgf@xc=-100\pgf@xc% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xb\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xc\pgf@sys@svg@percentchar)}% + }% +} +\def\pgf@sys@svg@color@gray#1\relax{% + {% + \pgf@xa=#1pt% + \pgf@xa=100\pgf@xa% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar,\pgf@sys@tonumber\pgf@xa\pgf@sys@svg@percentchar)}% + }% +} + +\def\pgf@sys@svg@gs@color#1{% + \ifpgfpicture\pgf@sys@svg@gs{#1}\fi% +} + +\def\pgfsys@color@rgb@stroke#1#2#3{% + \pgf@sys@svg@color@rgb#1,#2,#3\relax% + \pgf@sys@svg@gs@color{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@rgb@fill#1#2#3{% + \pgf@sys@svg@color@rgb#1,#2,#3\relax% + \pgf@sys@svg@gs@color{fill="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmyk@stroke#1#2#3#4{% + \pgf@sys@svg@color@cmyk#1,#2,#3,#4\relax% + \pgf@sys@svg@gs@color{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmyk@fill#1#2#3#4{% + \pgf@sys@svg@color@cmyk#1,#2,#3,#4\relax% + \pgf@sys@svg@gs@color{fill="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmy@stroke#1#2#3{% + \pgf@sys@svg@color@cmy#1,#2,#3\relax% + \pgf@sys@svg@gs@color{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmy@fill#1#2#3{% + \pgf@sys@svg@color@cmy#1,#2,#3\relax% + \pgf@sys@svg@gs@color{fill="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@gray@stroke#1{% + \pgf@sys@svg@color@gray#1\relax% + \pgf@sys@svg@gs@color{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@gray@fill#1{% + \pgf@sys@svg@color@gray#1\relax% + \pgf@sys@svg@gs@color{fill="\pgf@sys@svg@prepared"}} + + +% Shadings: +\def\pgf@sys@svg@shading@stops{% + % Step 1: Compute 1/\pgf@sys@shading@end@pos + \pgf@x=\pgf@sys@shading@end@pos\relax% + \c@pgf@counta=\pgf@x\relax% + \divide\c@pgf@counta by4096\relax% + % Step 2: Insert stops. + \expandafter\pgf@sys@svg@shading@dostops\pgf@sys@shading@ranges% + % dummy for end: + {{\pgf@sys@shading@end@pos}{\pgf@sys@shading@end@pos}{\pgf@sys@shading@end@rgb}{\pgf@sys@shading@end@rgb}}% + {}% end +} +\def\pgf@sys@svg@shading@dostops#1{% + \edef\pgf@test{#1}% + \ifx\pgf@test\pgfutil@empty% + \else% + \expandafter\pgf@sys@svg@shading@dostop\pgf@test% + \expandafter\pgf@sys@svg@shading@dostops% + \fi% +} +\def\pgf@sys@svg@shading@dostop#1#2#3#4{% + % #1 start pos + % #2 end pos + % #3 start rgb + % #4 end rgb + \pgf@sys@svg@addtostops{<stop offset="}% + \pgf@x=#1% + \pgf@x=16\pgf@x% + \divide\pgf@x by \c@pgf@counta\relax% + \pgf@sys@svg@addtostops{\pgf@sys@tonumber\pgf@x" stop-color="}% + \pgf@sys@svg@shading@dorgb#3% + \pgf@sys@svg@addtostops{"/>\noexpand\Hnewline}% +} +\def\pgf@sys@svg@shading@dorgb#1#2#3{% + \pgf@sys@svg@color@rgb#1,#2,#3\relax% + \pgf@sys@svg@addtostops{\pgf@sys@svg@prepared}% +} + +\let\pgf@sys@svg@thestops=\pgfutil@empty +\def\pgf@sys@svg@addtostops#1{% + \edef\pgf@temp{#1}% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\pgf@sys@svg@thestops + \expandafter\expandafter\expandafter{\expandafter\pgf@sys@svg@thestops\expandafter\space\pgf@temp}% +} + + +\def\pgfsys@horishading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@sys@svg@addtostops{<linearGradient id="pgfsh\the\pgf@sys@svg@objectcount">\noexpand\Hnewline} + \pgf@sys@svg@shading@stops% + \pgf@sys@svg@addtostops{</linearGradient>\noexpand\Hnewline}% + \pgf@process{\pgfpoint{\pgf@sys@shading@end@pos}{#2}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% + \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{<rect + width="\pgf@sys@tonumber{\pgf@x}" + height="\pgf@sys@tonumber{\pgf@y}" + style="fill:url(\noexpand\#pgfsh\the\pgf@sys@svg@objectcount); + stroke:none"/>\noexpand\Hnewline}}% + \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + }% + }% +} + +\def\pgfsys@functionalshading#1#2#3#4{% + \pgf@sys@fail{functional shadings}% + \expandafter\gdef\csname @pgfshading#1!\endcsname{% + \let\pgf@sys@svg@sh@defs\relax% + \let\pgf@sys@svg@sh\relax% + \let\pgf@sys@svg@pos\pgfpointorigin% + }% +} + +\def\pgfsys@vertshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@sys@svg@addtostops{<linearGradient + id="pgfsh\the\pgf@sys@svg@objectcount" + gradientTransform="rotate(90)">\noexpand\Hnewline} + \pgf@sys@svg@shading@stops% + \pgf@sys@svg@addtostops{</linearGradient>\noexpand\Hnewline}% + \pgf@process{\pgfpoint{\pgf@sys@shading@end@pos}{#2}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% + \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{<rect + width="\pgf@sys@tonumber{\pgf@y}" + height="\pgf@sys@tonumber{\pgf@x}" + style="fill:url(\noexpand\#pgfsh\the\pgf@sys@svg@objectcount); + stroke:none"/>\noexpand\Hnewline}}% + \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@y}{\the\pgf@x}}% + }% + }% +} + +\def\pgfsys@radialshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgf@x=\pgf@sys@shading@end@pos\relax% + \c@pgf@counta=\pgf@x\relax% + \divide\c@pgf@counta by4096\relax% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@process{#2}% + % Divide by 2\pgf@sys@shading@end@pos% + \pgf@x=8\pgf@x% + \divide\pgf@x by \c@pgf@counta\relax% + \pgf@y=8\pgf@y% + \divide\pgf@y by \c@pgf@counta\relax% + \advance\pgf@x by.5pt% + \advance\pgf@y by.5pt% + \pgf@sys@svg@addtostops{<radialGradient + id="pgfsh\the\pgf@sys@svg@objectcount" + fx="\pgf@sys@tonumber\pgf@x" + fy="\pgf@sys@tonumber\pgf@y" + >\noexpand\Hnewline} + \pgf@sys@svg@shading@stops% + \pgf@sys@svg@addtostops{</radialGradient>\noexpand\Hnewline}% + \pgf@xa=\pgf@sys@shading@end@pos% + \pgf@xb=2\pgf@xa% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% + \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{<circle + cx="\pgf@sys@tonumber{\pgf@xa}" + cy="\pgf@sys@tonumber{\pgf@xa}" + r="\pgf@sys@tonumber{\pgf@xa}" + style="fill:url(\noexpand\#pgfsh\the\pgf@sys@svg@objectcount); + stroke:none"/>\noexpand\Hnewline}}% + \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@xb}}% + }% + }% +} + + +% Patterns + +\def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{% + % Start building the pattern dictionary: + \pgf@xa=#2\relax% + \pgf@ya=#3\relax% + \pgf@xb=#4\relax% + \pgf@yb=#5\relax% + \pgf@xc=#6\relax% + \pgf@yc=#7\relax% + \ifnum#9=1\relax% + % Colored. That's easy: + \pgfsysprotocol@literal{ + <pattern + id="pgfpat#1" + patternUnits="userSpaceOnUse" + width="\the\pgf@xc" + height="\the\pgf@yc"> + #8 + </pattern>}% + \else% + % Uncolored. Yikes! + \pgfsysprotocol@literal{ + <pattern + id="pgfpat#1" + patternUnits="userSpaceOnUse" + width="\the\pgf@xc" + height="\the\pgf@yc"/> + <symbol id="pgfsym#1"> + #8 + </symbol>}% + \fi% +} + +\def\pgfsys@setpatternuncolored#1#2#3#4{% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@sys@svg@color@rgb#2,#3,#4\relax% + \pgfsysprotocol@literal{ + <pattern id="pgfupat\the\pgf@sys@svg@objectcount" xlink:href="\#pgfpat#1"> + <g stroke="\pgf@sys@svg@prepared" fill="\pgf@sys@svg@prepared"> <use xlink:href="\#pgfsym#1"/> </g> + </pattern>} + \pgf@sys@svg@gs@color{fill="url(\#pgfupat\the\pgf@sys@svg@objectcount)"}% +} + +\def\pgfsys@setpatterncolored#1{% + \pgf@sys@svg@gs@color{fill="url(\#pgfpat#1)"}% +} + + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def new file mode 100644 index 00000000000..05f647fc796 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def @@ -0,0 +1,392 @@ +% 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-dvi.def,v 1.5 2007/06/07 07:41:11 tantau Exp $ + +% Driver commands for pure, ultra-portable dvi, in the tradition of +% old-style LaTeX pictures. +% +% Do not expect magic from this file + + +\newtoks\pgf@sys@dvi@path +\def\pgf@sys@dvi@addtopath#1{\pgf@sys@dvi@path\expandafter{\the\pgf@sys@dvi@path#1}} + +% Placing an object: +\def\pgf@sys@dvi@put#1#2#3{% + {% + \setbox\pgf@hbox=\hbox{\raise#2\hbox to0pt{\kern#1\relax#3\hss}}% + \wd\pgf@hbox=0pt% + \ht\pgf@hbox=0pt% + \dp\pgf@hbox=0pt% + \box\pgf@hbox% + }% +} + +\def\pgf@sys@dvi@drawrect#1#2#3#4{% + {% + \pgf@x=#1% + \pgf@y=#2% + \pgf@xa=#3% + \pgf@ya=#4% + \ifdim\pgf@xa<0pt% + \advance\pgf@x by\pgf@xa% + \pgf@xa=-\pgf@xa% + \fi% + \ifdim\pgf@ya<0pt% + \advance\pgf@y by\pgf@ya% + \pgf@ya=-\pgf@ya% + \fi% + \pgf@sys@dvi@put{\pgf@x}{\pgf@y}{\vrule width\pgf@xa height\pgf@ya}% + }% +} + +\def\pgf@sys@dvi@bezier{% + {% + % First iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% + \pgf@xa=\pgf@time@t\pgf@xa\advance\pgf@xa by\pgf@time@s\pgf@xb% + \pgf@ya=\pgf@time@t\pgf@ya\advance\pgf@ya by\pgf@time@s\pgf@yb% + \pgf@xb=\pgf@time@t\pgf@xb\advance\pgf@xb by\pgf@time@s\pgf@xc% + \pgf@yb=\pgf@time@t\pgf@yb\advance\pgf@yb by\pgf@time@s\pgf@yc% + % Second iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% + \pgf@xa=\pgf@time@t\pgf@xa\advance\pgf@xa by\pgf@time@s\pgf@xb% + \pgf@ya=\pgf@time@t\pgf@ya\advance\pgf@ya by\pgf@time@s\pgf@yb% + % Third iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% + % + \advance\pgf@x by-.5\pgf@sys@dvi@linewidth% + \advance\pgf@y by-.5\pgf@sys@dvi@linewidth% + \pgf@sys@dvi@drawrect{\pgf@x}{\pgf@y}{\pgf@sys@dvi@linewidth}{\pgf@sys@dvi@linewidth}% + }% +} + +\def\pgf@sys@dvi@drawcurve#1#2#3#4#5#6#7#8{% + {% + \pgf@x=#1% + \pgf@y=#2% + \pgf@xa=#3% + \pgf@ya=#4% + \pgf@xb=#5% + \pgf@yb=#6% + \pgf@xc=#7% + \pgf@yc=#8% + % Compute number of steps: + \pgfutil@tempdima=\pgf@x% + \advance\pgfutil@tempdima by-\pgf@xa% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdimb=-\pgfutil@tempdima% + \else% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempdima=\pgf@y% + \advance\pgfutil@tempdima by-\pgf@ya% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdima=-\pgfutil@tempdima% + \fi% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempdima=\pgf@xb% + \advance\pgfutil@tempdima by-\pgf@xc% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdima=-\pgfutil@tempdima% + \fi% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempdima=\pgf@yb% + \advance\pgfutil@tempdima by-\pgf@yc% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdima=-\pgfutil@tempdima% + \fi% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempdima=\pgf@x% + \advance\pgfutil@tempdima by-\pgf@xc% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdima=-\pgfutil@tempdima% + \fi% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempdima=\pgf@y% + \advance\pgfutil@tempdima by-\pgf@yc% + \ifdim\pgfutil@tempdima<0pt% + \pgfutil@tempdima=-\pgfutil@tempdima% + \fi% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \pgfutil@tempdimb=\pgfutil@tempdima% + \fi% + \pgfutil@tempcnta=\pgfutil@tempdimb% + \ifdim\pgf@sys@dvi@linewidth>0.3pt% + \pgfutil@tempdimb=0.15pt% + \else% + \ifdim\pgf@sys@dvi@linewidth<0.05pt% + \pgfutil@tempdimb=.025pt% + \else% + \pgfutil@tempdimb=.5\pgf@sys@dvi@linewidth% + \fi% + \fi% + \pgfutil@tempcntb=\pgfutil@tempdimb% + \divide\pgfutil@tempcnta by\pgfutil@tempcntb\relax% + \ifnum\pgfutil@tempcnta>0\relax% + \pgfutil@tempcntb=0\relax% + \loop% + {% + \pgfutil@tempdima=\the\pgfutil@tempcntb pt% + \pgfutil@tempdimb=\the\pgfutil@tempcnta pt% + \advance\pgfutil@tempdimb by-\pgfutil@tempdima\relax% + \divide\pgfutil@tempdima by\pgfutil@tempcnta\relax% + \divide\pgfutil@tempdimb by\pgfutil@tempcnta\relax% + \edef\pgf@time@t{\pgf@sys@tonumber{\pgfutil@tempdima}}% + \edef\pgf@time@s{\pgf@sys@tonumber{\pgfutil@tempdimb}}% + \pgf@sys@dvi@bezier% + }% + \advance\pgfutil@tempcntb by1\relax + \ifnum\pgfutil@tempcntb<\pgfutil@tempcnta% + {\def\pgf@time@t{1}\def\pgf@time@s{0}\pgf@sys@dvi@bezier}% + \repeat% + \fi% + }% +} + +% Text: +\def\pgfsys@hbox#1{% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \pgf@sys@dvi@put{\pgf@sys@dvi@pt@x}{\pgf@sys@dvi@pt@y}{\box#1}% +} + + + +% Literals: + +\def\pgfsys@invoke#1{#1} + + +% Buffered path construction: + +\def\pgfsys@moveto#1#2{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@addtopath{\noexpand\pgf@sys@dvi@moveto{#1}{#2}}}} +\def\pgfsys@lineto#1#2{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@addtopath{\noexpand\pgf@sys@dvi@lineto{#1}{#2}}}} +\def\pgfsys@curveto#1#2#3#4#5#6{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@addtopath{\noexpand\pgf@sys@dvi@curveto{#1}{#2}{#3}{#4}{#5}{#6}}}} +\def\pgfsys@rect#1#2#3#4{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@addtopath{\noexpand\pgf@sys@dvi@rect{#1}{#2}{#3}{#4}}}} +\def\pgfsys@closepath{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@addtopath{\noexpand\pgf@sys@dvi@closepath}}} + + +% Scoping +\def\pgfsys@beginscope{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@beginscope}}% +\def\pgfsys@endscope{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@endscope}}% + +\def\pgf@sys@dvi@beginscope{% + % Save current stuff... + \edef\pgf@sys@dvi@return{% + \global\pgf@sys@dvi@linewidth=\the\pgf@sys@dvi@linewidth% + \global\pgf@sys@dvi@pt@x=\the\pgf@sys@dvi@pt@x% + \global\pgf@sys@dvi@pt@y=\the\pgf@sys@dvi@pt@y% + \gdef\noexpand\pgf@sys@dvi@pt@aa{\pgf@sys@dvi@pt@aa}% + \gdef\noexpand\pgf@sys@dvi@pt@ab{\pgf@sys@dvi@pt@ab}% + \gdef\noexpand\pgf@sys@dvi@pt@ba{\pgf@sys@dvi@pt@ba}% + \gdef\noexpand\pgf@sys@dvi@pt@bb{\pgf@sys@dvi@pt@bb}% + }% + \begingroup% + \ignorespaces% +} + +\def\pgf@sys@dvi@endscope{% + \endgroup% + \pgf@sys@dvi@return% +} + + + +% Line width + +\newdimen\pgf@sys@dvi@linewidth +\pgf@sys@dvi@linewidth=0.4pt + +\def\pgfsys@setlinewidth#1{\global\pgf@sys@dvi@linewidth=#1\relax} + + +% Transformation matrix + +\newdimen\pgf@sys@dvi@pt@x +\newdimen\pgf@sys@dvi@pt@y + +\def\pgf@sys@dvi@pt@aa{1.0} \def\pgf@sys@dvi@pt@ab{0.0} +\def\pgf@sys@dvi@pt@ba{0.0} \def\pgf@sys@dvi@pt@bb{1.0} + +\def\pgf@sys@dvi@pos@transform#1#2{% + \pgf@pt@temp=#1% + #1=\pgf@sys@dvi@pt@aa#1% + \advance#1 by\pgf@sys@dvi@pt@ba#2% + #2=\pgf@sys@dvi@pt@bb#2% + \advance#2 by\pgf@sys@dvi@pt@ab\pgf@pt@temp% + \advance#1 by\pgf@sys@dvi@pt@x% + \advance#2 by\pgf@sys@dvi@pt@y% +} + +\def\pgf@sys@dvi@transformcm#1#2#3#4#5#6{% + {% + \pgf@xc=#5% + \pgf@yc=#6% + % + \pgf@x=#1pt% + \pgf@y=#2pt% + % + \pgf@xa=\pgf@sys@dvi@pt@aa\pgf@x% + \advance\pgf@xa by \pgf@sys@dvi@pt@ba\pgf@y% + % + \pgf@ya=\pgf@sys@dvi@pt@ab\pgf@x% + \advance\pgf@ya by \pgf@sys@dvi@pt@bb\pgf@y% + % + \pgf@x=#3pt% + \pgf@y=#4pt% + % + \pgf@xb=\pgf@sys@dvi@pt@aa\pgf@x% + \advance\pgf@xb by \pgf@sys@dvi@pt@ba\pgf@y% + % + \pgf@yb=\pgf@sys@dvi@pt@ab\pgf@x% + \advance\pgf@yb by \pgf@sys@dvi@pt@bb\pgf@y% + % + \pgf@x=\pgf@sys@dvi@pt@aa\pgf@xc% + \advance\pgf@x by\pgf@sys@dvi@pt@ba\pgf@yc% + \advance\pgf@x by\pgf@sys@dvi@pt@x% + % + \pgf@y=\pgf@sys@dvi@pt@ab\pgf@xc% + \advance\pgf@y by\pgf@sys@dvi@pt@bb\pgf@yc% + \advance\pgf@y by\pgf@sys@dvi@pt@y% + % + \global\pgf@sys@dvi@pt@x=\pgf@x% + \global\pgf@sys@dvi@pt@y=\pgf@y% + \xdef\pgf@sys@dvi@pt@aa{\pgf@sys@tonumber{\pgf@xa}}% + \xdef\pgf@sys@dvi@pt@ab{\pgf@sys@tonumber{\pgf@ya}}% + \xdef\pgf@sys@dvi@pt@ba{\pgf@sys@tonumber{\pgf@xb}}% + \xdef\pgf@sys@dvi@pt@bb{\pgf@sys@tonumber{\pgf@yb}}% + }% +} + +\def\pgfsys@transformcm#1#2#3#4#5#6{% + {% + \pgf@x=#5\relax% + \pgf@y=#6\relax% + \pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@transformcm{#1}{#2}{#3}{#4}{\the\pgf@x}{\the\pgf@y}}% + }% +} + + +% Stroking + +\def\pgfsys@stroke{\pgfsysprotocol@literal{\noexpand\pgf@sys@dvi@stroke}}% + + +\def\pgf@sys@dvi@stroke{% + \let\pgf@sys@dvi@moveto=\pgf@sys@dvi@moveto@stroke% + \let\pgf@sys@dvi@lineto=\pgf@sys@dvi@lineto@stroke% + \let\pgf@sys@dvi@curveto=\pgf@sys@dvi@curveto@stroke% + \let\pgf@sys@dvi@rect=\pgf@sys@dvi@rect@stroke% + \let\pgf@sys@dvi@closepath=\pgf@sys@dvi@closepath@stroke% + {\the\pgf@sys@dvi@path}% + \pgf@sys@dvi@path{}% +} + +\def\pgf@sys@dvi@moveto@stroke#1#2{% + % These two store the current position: + \pgf@xc=#1\relax% + \pgf@yc=#2\relax% + % These two store the last moveto: + \pgf@xb=\pgf@xc% + \pgf@yb=\pgf@yc% +} + +\def\pgf@sys@dvi@lineto@stroke#1#2{% + {% + \pgf@xa=#1\relax% + \pgf@ya=#2\relax% + \pgf@x=\pgf@xc% + \pgf@y=\pgf@yc% + \pgf@sys@dvi@pos@transform{\pgf@xa}{\pgf@ya}% + \pgf@sys@dvi@pos@transform{\pgf@x}{\pgf@y}% + % Now, we need to draw a line from (x/y) to (xa/ya) + % + % Horizontal? + \ifdim\pgf@y=\pgf@ya% + % Ok, that should be easy... + \pgf@xb=\pgf@xa% + \advance\pgf@xb by-\pgf@x% + \advance\pgf@y by-0.5\pgf@sys@dvi@linewidth% + \pgf@sys@dvi@drawrect{\pgf@x}{\pgf@y}{\pgf@xb}{\pgf@sys@dvi@linewidth}% + \else% + \ifdim\pgf@x=\pgf@xa% + % Ok, also easy... + \pgf@yb=\pgf@ya% + \advance\pgf@yb by-\pgf@y% + \advance\pgf@x by-0.5\pgf@sys@dvi@linewidth% + \pgf@sys@dvi@drawrect{\pgf@x}{\pgf@y}{\pgf@sys@dvi@linewidth}{\pgf@yb}% + \else% + \edef\pgf@marshal{\noexpand\pgf@sys@dvi@drawcurve{\the\pgf@x}{\the\pgf@y}{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}{\the\pgf@xa}{\the\pgf@ya}}% + \pgf@marshal% + \fi% + \fi% + }% + % Remember: + \pgf@xc=#1\relax% + \pgf@yc=#2\relax% +} + + +\def\pgf@sys@dvi@curveto@stroke#1#2#3#4#5#6{% + \pgf@x=\pgf@xc% + \pgf@y=\pgf@yc% + \pgf@xa=#1% + \pgf@ya=#2% + \pgf@xb=#3% + \pgf@yb=#4% + \pgf@xc=#5% + \pgf@yc=#6% + {% + \pgf@sys@dvi@pos@transform{\pgf@x}{\pgf@y}% + \pgf@sys@dvi@pos@transform{\pgf@xa}{\pgf@ya}% + \pgf@sys@dvi@pos@transform{\pgf@xb}{\pgf@yb}% + \pgf@sys@dvi@pos@transform{\pgf@xc}{\pgf@yc}% + \pgf@sys@dvi@drawcurve{\pgf@x}{\pgf@y}{\pgf@xa}{\pgf@ya}{\pgf@xb}{\pgf@yb}{\pgf@xc}{\pgf@yc}% + }% +} + +\def\pgf@sys@dvi@closepath@stroke{% + \pgf@sys@dvi@lineto@stroke{\pgf@xc}{\pgf@yc}% +} + +\def\pgf@sys@dvi@rect@stroke#1#2#3#4{% + \pgf@x=#1\relax% + \pgf@y=#2\relax% + \pgf@xa=#3\relax% + \pgf@ya=#4\relax% + \advance\pgf@xa by\pgf@x% + \advance\pgf@ya by\pgf@y% + \pgf@sys@dvi@moveto@stroke{\pgf@x}{\pgf@y}% + \pgf@sys@dvi@lineto@stroke{\pgf@xa}{\pgf@y}% + \pgf@sys@dvi@lineto@stroke{\pgf@xa}{\pgf@ya}% + \pgf@sys@dvi@lineto@stroke{\pgf@x}{\pgf@ya}% + \pgf@sys@dvi@closepath@stroke% +} + + + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def new file mode 100644 index 00000000000..16edebc350b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def @@ -0,0 +1,40 @@ +% 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-dvipdfm.def,v 1.18 2007/12/17 14:52:31 tantau Exp $ + +% Driver commands for dvipdfm + +% +% Load common pdf and pdf in dvi commands: +% +\input pgfsys-common-pdf.def +\input pgfsys-common-pdf-via-dvi.def + +% +% dvipdfm-specific stuff: +% + + + +% +% Position tracking (needs pdftex >= 1.40.0-alpha-20051205 in dvi mode) +% +\ifx\pdftexversion\@undefined +\else + \ifnum\pdftexversion>139 + \pgf@sys@pdf@dvi@tracker + \fi +\fi + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def new file mode 100644 index 00000000000..af868df5fc4 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def @@ -0,0 +1,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.19 2007/12/12 16:57:17 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{\AtBeginDvi{\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{% + \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}bind def + /pgfeofill{gsave pgffoa .setopacityalpha eofill 1 .setopacityalpha newpath eofill grestore}bind def}bind def + /.pgfsetstrokeopacityalpha{/pgfsoa exch def + /pgfstr{gsave pgfsoa .setopacityalpha stroke grestore}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\write\expandafter\pgfutil@auxout\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: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def new file mode 100644 index 00000000000..c9881df5737 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def @@ -0,0 +1,395 @@ +% 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-pdftex.def,v 1.20 2007/12/20 10:56:53 tantau Exp $ + + +% Driver commands for pdf + +% +% Load common pdf commands: +% +\input pgfsys-common-pdf.def + +% +% pdftex-specific stuff: +% +\def\pgfsys@invoke#1{\pdfliteral{#1}} + +\def\pgfsys@hboxsynced#1{% + {% + \pgfsys@beginscope% + \setbox\pgf@hbox=\hbox{% + \hskip\pgf@pt@x% + \raise\pgf@pt@y\hbox{% + \pgf@pt@x=0pt% + \pgf@pt@y=0pt% + \pgflowlevelsynccm% + \pgfsys@hbox#1}% + \hss% + }% + \wd\pgf@hbox=0pt% + \ht\pgf@hbox=0pt% + \dp\pgf@hbox=0pt% + \box\pgf@hbox% + \pgfsys@endscope% + }% +} + + +% Page resources (they are kept in objects and only written at the +% very end) + +\pdfobj reserveobjnum +\edef\pgf@sys@pdf@extgs@objnum{\the\pdflastobj} + +\pdfobj reserveobjnum +\edef\pgf@sys@pdf@pattern@objnum{\the\pdflastobj} + +\immediate \pdfobj {<< /pgfprgb [/Pattern /DeviceRGB] >>}%<< +\edef\pgf@sys@pdf@cs@objnum{\the\pdflastobj} + +\def\pgf@sys@pdf@possible@resources{% + /ColorSpace \pgf@sys@pdf@cs@objnum\space 0 R + /Pattern \pgf@sys@pdf@pattern@objnum\space 0 R + /ExtGState \pgf@sys@pdf@extgs@objnum\space 0 R +} + +{ + \edef\temp{ + \pgf@sys@pdf@possible@resources + } + \expandafter\global\expandafter\pdfpageresources\expandafter{\temp} +} + +\expandafter\pgfutil@everybye\expandafter{% + \the\pgfutil@everybye% + \immediate \pdfobj useobjnum \pgf@sys@pdf@extgs@objnum {<<\pgf@sys@pgf@resource@list@extgs>>}%<< + \immediate \pdfobj useobjnum \pgf@sys@pdf@pattern@objnum {<<\pgf@sys@pgf@resource@list@patterns>>}%<< +} + +\let\pgf@sys@pgf@resource@list@extgs=\pgfutil@empty% +\let\pgf@sys@pgf@resource@list@patterns=\pgfutil@empty% + +\def\pgf@sys@pdf@addtopageresources@extgs#1{% + \xdef\pgf@sys@pgf@resource@list@extgs{\pgf@sys@pgf@resource@list@extgs\space#1}% +} + +\def\pgf@sys@pdf@addtopageresources@patterns#1{% + \xdef\pgf@sys@pgf@resource@list@patterns{\pgf@sys@pgf@resource@list@patterns\space#1}% +} + + +\def\pgfsys@imagesuffixlist{.pdf:.jpg:.jpeg:.png:} +\def\pgfsys@defineimage{% width, height, page number + \ifx\pgf@imagewidth\pgfutil@empty\else\edef\pgf@imagewidth{ width \pgf@imagewidth }\fi% + \ifx\pgf@imageheight\pgfutil@empty\else\edef\pgf@imageheight{ height \pgf@imageheight }\fi% + \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepage{ page \pgf@imagepage }\fi% + \ifx\pdfximage\@undefined% old version of pdflatex + \ifx\pgf@imagepage\pgfutil@empty\else% + \PackageWarning{pgf}{Page selection not supported. Ignoring + page selection}% + \fi% + \setbox\pgfutil@tempboxa=\hbox{% + \pdfimage \pgf@imageheight \pgf@imagewidth {\pgf@filename}}% + \pdfform\pgfutil@tempboxa% + \edef\pgf@image{\noexpand\pdfrefform\the\pdflastform}% + \else% new version + {\pdfximage \pgf@imageheight \pgf@imagewidth attr + {\pgf@imageinterpolate\space\pgf@imagemask} \pgf@imagepage + {\pgf@filename}}% + \edef\pgf@image{\noexpand\pdfrefximage\the\pdflastximage}% + \fi +}% +\def\pgfsys@definemask{% + \ifx\pgf@maskmatte\pgfutil@empty% + \else% + \edef\pgf@maskmatte{/Matte [\pgf@maskmatte]}% + \fi% + \edef\pgf@attr{{\pgf@maskmatte\space /Decode [1 0]}}% + \immediate\pdfximage attr \pgf@attr {\pgf@filename}% + \edef\pgf@mask{\the\pdflastximage}% +} +\def\pgfsys@horishading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgfmathparse{#2}% + \setbox\pgfutil@tempboxa=\hbox to\pgf@max{\vbox to\pgfmathresult pt{\vfil\pgfsys@invoke{/Sh sh}}\hfil}% + \pgf@process{\pgfpoint{\pgf@max}{#2}}% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 2 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [\pgf@doma\space0 \pgf@domb\space0] + /Function \pgf@pdfparsedfunction + /Extend [false false] >> >>}\pgfutil@tempboxa% << + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + }% +} +\def\pgfsys@vertshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgfmathparse{#2}% + \setbox\pgfutil@tempboxa=\hbox to\pgfmathresult pt{\vbox to\pgf@max{\vfil\pgfsys@invoke{/Sh sh}}\hfil}% + \pgf@process{\pgfpoint{#2}{\pgf@max}}% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 2 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [0 \pgf@doma\space0 \pgf@domb] + /Function \pgf@pdfparsedfunction + /Extend [false false] >> >>}\pgfutil@tempboxa% << + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + }% +} +\def\pgfsys@radialshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \setbox\pgfutil@tempboxa=\hbox to2\pgf@max{\vbox to2\pgf@max{\vfil\pgfsys@invoke{/Sh sh}}\hfil}% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgfpoint{\pgf@max}{\pgf@max}}% + \advance\pgf@xa by \pgf@x% + \advance\pgf@ya by \pgf@y% + \pgf@sys@bp@correct{\pgf@x}% + \pgf@sys@bp@correct{\pgf@y}% + \pgf@sys@bp@correct{\pgf@xa}% + \pgf@sys@bp@correct{\pgf@ya}% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 3 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [\pgf@sys@tonumber{\pgf@xa} \pgf@sys@tonumber{\pgf@ya} \pgf@doma\space \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@y} \pgf@domb] + /Function \pgf@pdfparsedfunction + /Extend [true false] >> >>}\pgfutil@tempboxa% << + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + }% +}% +\def\pgfsys@functionalshading#1#2#3#4{% + {% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \setbox\pgfutil@tempboxa=\hbox to\pgf@x{\vbox to\pgf@y{\vfil\pgfsys@invoke{/Sh sh}}\hfil}% + \pgf@sys@bp@correct{\pgf@xa}% + \pgf@sys@bp@correct{\pgf@ya}% + \pgf@sys@bp@correct{\pgf@xb}% + \pgf@sys@bp@correct{\pgf@yb}% + \pgf@xc=-\pgf@xa% + \pgf@yc=-\pgf@ya% + % Now build the function + \pdfobj + stream + attr + { + /FunctionType 4 + /Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}] + /Range [0 1 0 1 0 1] + } + {{#4}}% + \edef\pgf@temp@num{\the\pdflastobj}% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 1 + /ColorSpace /DeviceRGB + /Matrix [1 0 0 1 \pgf@sys@tonumber{\pgf@xc}\space\pgf@sys@tonumber{\pgf@yc}] + /Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}] + /Function \pgf@temp@num\space 0 R + >> >>}\pgfutil@tempboxa% << + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \leavevmode% + \noexpand\pdfrefxform\the\pdflastxform% + \noexpand\pdfrefobj\pgf@temp@num% + }% + }% +} + + + +% Patterns + +\def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{% + % Start building the pattern dictionary: + \pgf@xa=#2\relax% + \pgf@ya=#3\relax% + \pgf@xb=#4\relax% + \pgf@yb=#5\relax% + \pgf@xc=#6\relax% + \pgf@yc=#7\relax% + \pgf@sys@bp@correct\pgf@xa% + \pgf@sys@bp@correct\pgf@ya% + \pgf@sys@bp@correct\pgf@xb% + \pgf@sys@bp@correct\pgf@yb% + \pgf@sys@bp@correct\pgf@xc% + \pgf@sys@bp@correct\pgf@yc% + % Now create the pattern object: + \immediate\pdfobj stream + attr + { + /Type /Pattern + /PatternType 1 + /PaintType \ifnum#9=0 2 \else 1 \fi + /TilingType 1 + /BBox [\pgf@sys@tonumber\pgf@xa\space\pgf@sys@tonumber\pgf@ya\space\pgf@sys@tonumber\pgf@xb\space\pgf@sys@tonumber\pgf@yb] + /XStep \pgf@sys@tonumber\pgf@xc\space + /YStep \pgf@sys@tonumber\pgf@yc\space + /Resources << >> %<< + } + {#8}% + \pgf@sys@pdf@addtopageresources@patterns{/pgfpat#1\space \the\pdflastobj\space 0 R}% +} + +\def\pgfsys@setpatternuncolored#1#2#3#4{% + \pgfsysprotocol@literal{/pgfprgb cs #2 #3 #4 /pgfpat#1\space scn}% +} + +\def\pgfsys@setpatterncolored#1{% + \pgfsysprotocol@literal{/Pattern cs /pgfpat#1\space scn}% +} + + +\def\pgfsys@papersize#1#2{% + \pdfpageheight#2% + \pdfpagewidth#1} + + + % XForm version, crashes ghostview. + %\def\pgfsys@defobject#1#2#3#4{% + % \pgf@process{#2} + % \setbox\pgfobjectbox\hbox{\raise-\pgf@y\hbox{\hskip-\pgf@x\relax#4}} + % \pgf@process{#3} + % \pgf@xa=\pgf@x + % \pgf@ya=\pgf@y + % \pgf@process{#2} + % \advance\pgf@xa by-\pgf@x + % \advance\pgf@ya by-\pgf@y + % \wd\pgfobjectbox=\pgf@xa + % \dp\pgfobjectbox=0pt + % \ht\pgfobjectbox=\pgf@ya + % \pdfxform\pgfobjectbox + % \expandafter\xdef\csname#1\endcsname{\the\pdflastxform} + % \expandafter\xdef\csname pgf@trans#1\endcsname + % {{\pgfget x}{\pgfget y}}} + %\def\pgfsys@useobject#1#2{% + % \setbox\pgfobjectbox\hbox{\pdfrefxform \csname#1\endcsname}% + % \dp\pgfobjectbox=0pt% + % \ht\pgfobjectbox=0pt% + % \wd\pgfobjectbox=0pt% + % \pgfsys@discardpath% + % \pgfsys@beginscope% + % #2% + % \edef\pgf@temp{{1}{0}{0}{1}\csname pgf@trans#1\endcsname}% + % \expandafter\pgfsys@transform\pgf@temp% + % \box\pgfobjectbox% + % \pgfsys@endscope} + + + +% +% Position tracking +% +\def\pgfsys@markposition#1{% + \pdfsavepos% + \edef\pgf@temp{#1}% + \expandafter\write\expandafter\pgfutil@auxout\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} + + +% +% Opacity masks +% +\def\pgfsys@fadingfrombox#1#2{% + {% + \pgf@x=-.5\wd#2% + \pgf@y=-.5\ht#2% + \advance\pgf@y by.5\dp#2% + \expandafter\xdef\csname pgfsmasktrans@#1\endcsname{% + \noexpand\pgftransformcm{1}{0}{0}{1}{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% + \pdfxform resources { \pgf@sys@pdf@possible@resources } #2% + \expandafter\xdef\csname pgfsmaskxform@#1\endcsname{\the\pdflastxform}% + }% +} +\def\pgfsys@usefading#1#2#3#4#5#6#7{% + \expandafter\ifx\csname pgfsmaskxform@#1\endcsname\relax% + \PackageError{pgf}{Undefined fading '#1'}{}% + \else% + {% + \expandafter\ifx\csname pgfsmaks@#1\endcsname\relax% + \pgf@sys@pdf@install@mask{#1}% + \fi% + \pgftransformreset% + \pgftransformcm{#2}{#3}{#4}{#5}{\pgfpoint{#6}{#7}}% + \csname pgfsmasktrans@#1\endcsname% + {% + \pgflowlevelsynccm% + \pgfsys@invoke{/pgfsmask\csname pgfsmask@#1\endcsname\space gs}% + }% + \pgftransforminvert% + \pgflowlevelsynccm% + }% + \fi +} + +\def\pgf@sys@pdf@install@mask#1{% + \setbox\pgfutil@tempboxa=\hbox{\pdfrefxform\csname pgfsmaskxform@#1\endcsname} + \immediate\pdfxform% + attr { + /Group + << + /S /Transparency + /CS /DeviceGray + >> + }% << + \pgfutil@tempboxa% + \pgf@sys@pdf@addtopageresources@extgs{% + /pgfsmask\the\pdflastxform\space + << + /SMask + << + /S /Luminosity + /G \the\pdflastxform\space 0 R + >> + >> } %<< + \expandafter\xdef\csname pgfsmask@#1\endcsname{\the\pdflastxform}% +} + +% +% Transparency groups +% +\def\pgfsys@transparencygroupfrombox#1{% + \pdfxform + attr { /Group << /S /Transparency >> } %<< + resources { \pgf@sys@pdf@possible@resources } + #1% + \setbox#1=\hbox{\pdfrefxform\pdflastxform}% +} + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def new file mode 100644 index 00000000000..76202d4c842 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def @@ -0,0 +1,193 @@ +% 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-tex4ht.def,v 1.16 2008/02/07 19:25:41 tantau Exp $ + + +\RequirePackage{xcolor} + + +% Driver commands for tex4ht + +% +% Load common pdf commands: +% +\input pgfsys-common-svg.def + +% +% tex4ht-specific stuff: +% +\def\pgfsys@invoke#1{\pgf@sys@fail{svg code in preamble}} +\def\pgfsys@body@invoke#1{\HCode{#1}} + +\newcount\pgf@sys@svg@picnum + + +\def\pgfsys@beginpicture{% + \Configure{[]}{$}{$} + \Configure{()}{$}{$} + \Configure{$$}{}{}{}%$$ + \Configure{$}{}{}{}%$ + \Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}} + \Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}} + \Configure{SUBSUP}{}{}{} + \Configure{htf} + {0}{+}{<tspan font-family="} + {\%s}{" font-size="\%s}{}{} + {">}{</tspan>} +} +\def\pgfsys@endpicture{% + % undo: + \Configure{htf}{0}{+}{<span\Hnewline + class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>} +} + +\def\pgfsys@typesetpicturebox#1{% + \global\advance\pgf@sys@svg@picnum by 1\relax% + % Ok, compute width/height + \pgf@xa=\pgf@picminx% + \pgf@ya=\pgf@picminy% + \pgf@xb=\pgf@picmaxx% + \pgf@yb=\pgf@picmaxy% + \pgf@x=\pgf@xb% + \advance\pgf@x by-\pgf@xa% + \pgf@y=\pgf@yb% + \advance\pgf@y by-\pgf@ya% + \ifdim\pgf@y<1pt% + \pgf@y=1pt% + \fi% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfsysprotocol@flushcurrentprotocol% + \HCode{<object data="\jobname-\the\pgf@sys@svg@picnum.svg" + width="}% + % Calculate pixel coordinates (this does not really make sense, but + % we have to do it anyway). Assume 96dpi. + \pgf@x=1.3333333\pgf@x% + \pgf@y=1.3333333\pgf@y% + % Add one pixel for security: + \advance\pgf@x by1pt% + \advance\pgf@y by1pt% + \pgf@sys@pt\pgf@x% + \pgfsysprotocol@flushcurrentprotocol% + \pgfsys@invoke{" height="}% + \pgf@sys@pt\pgf@y% + \pgfsysprotocol@flushcurrentprotocol% + \pgfsys@invoke{" type="image/svg+xml"><p>SVG-Viewer needed.</p></object>}% + \special{t4ht>\jobname-\the\pgf@sys@svg@picnum.svg}% + \pgfsys@invoke{<svg xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" width="\the\pgf@xc" + height="\the\pgf@yc" viewBox="}% + \pgf@sys@pt{\pgf@xa}\pgf@sys@pt{\pgf@ya}\pgf@sys@pt{\pgf@xc}\pgf@sys@pt{\pgf@yc}% + \pgfsysprotocol@flushcurrentprotocol% + \pgf@ya=-\pgf@ya% + \pgfsys@invoke{">\Hnewline <g transform="translate(0,} + \pgf@sys@pt\pgf@yb\pgfsysprotocol@flushcurrentprotocol% + \pgfsys@invoke{) scale(1,-1) translate(0,}% + \pgf@sys@pt\pgf@ya\pgfsysprotocol@flushcurrentprotocol% + \pgfsys@invoke{)">\Hnewline }% + \pgfmathsetlength\pgf@x{\pgf@shift@baseline}% + \advance\pgf@x by-\pgf@picminy\relax% + \advance\pgf@picmaxy by-\pgf@picminy\relax% maxy is now the height + \advance\pgf@picmaxx by-\pgf@picminx\relax% maxx is now the width + \setbox#1=\hbox{\hskip-\pgf@picminx\lower\pgf@picminy\box#1}% + \ht#1=\pgf@picmaxy% + \wd#1=\pgf@picmaxx% + \dp#1=0pt% + \leavevmode\raise-\pgf@x\box#1% + \pgfsys@invoke{</g>\Hnewline </svg>\Hnewline }% + \special{t4ht<\jobname-\the\pgf@sys@svg@picnum.svg}% +} + +\def\pgfsys@hbox#1{% + \pgf@x=.5\wd#1% + \ifx\tikz@textcolor\relax% + \else% + \ifx\tikz@textcolor\pgfutil@empty% + \pgfsetfillcolor{.}% + \else% + \pgfsetfillcolor{\tikz@textcolor}% + \fi% + \fi% tweak for TikZ + \HCode{<text + style="stroke:none" + transform="scale(1,-1) translate(\pgf@sys@tonumber{\pgf@x},0)" + text-anchor="middle" + }% + \ifx\f@size\pgfutil@empty% + \else% + \HCode{ font-size="\f@size"}% + \fi% + \HCode{>\Hnewline }% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1 + \HCode{</text>\Hnewline }% +} + +\def\pgfsys@outerinvoke{\ifpgfpicture\expandafter\pgfsys@invoke\else\expandafter\pgfutil@gobble\fi} + +\def\pgfsys@shadingoutsidepgfpicture#1{\pgf@sys@fail{svg code in preamble}} +\def\pgfsys@shadinginsidepgfpicture#1{\pgf@sys@fail{svg code in preamble}} + +\def\pgfsys@body@shadingoutsidepgfpicture#1{% + \begingroup% + #1% + \setbox\pgfpic=\hbox to0pt{% + \pgfsys@beginpicture% + \pgfsys@beginscope% + \pgf@sys@svg@sh@defs% + \pgf@sys@svg@sh% + \pgfsys@endscope% + \pgfsys@endpicture% + \hss% + }% + \pgf@process{\pgf@sys@svg@pos}% + \pgf@picminx=0pt% + \pgf@picminy=0pt% + \pgf@picmaxx=\pgf@x% + \pgf@picmaxy=\pgf@y% + \def\pgf@shift@baseline{0pt}% + \pgfsys@typesetpicturebox\pgfpic% + \endgroup% +} + +\def\pgfsys@body@shadinginsidepgfpicture#1{% + #1% + \pgf@sys@svg@sh@defs% hmmm.... + \pgf@process{\pgf@sys@svg@pos} + \pgf@xa=-.5\pgf@x% + \pgf@ya=-.5\pgf@y% + \pgfsysprotocol@literal{<g transform="translate(\pgf@sys@tonumber{\pgf@xa},\pgf@sys@tonumber{\pgf@ya})">\Hnewline}% + \pgf@sys@svg@sh% + \pgfsysprotocol@literal{</g>\Hnewline}% +} + +% Protect against color.4ht evil meddling with xcolor: +\let\pgf@xcolor@declaredcolor=\@declaredcolor +\let\pgf@xcolor@undeclaredcolor=\@undeclaredcolor + +\AtBeginDocument{ + \let\pgfsys@invoke=\pgfsys@body@invoke + \let\pgfsys@shadingoutsidepgfpicture=\pgfsys@body@shadingoutsidepgfpicture + \let\pgfsys@shadinginsidepgfpicture=\pgfsys@body@shadinginsidepgfpicture + \let\pgf@texht@declaredcolor=\@declaredcolor + \let\pgf@texht@undeclaredcolor=\@undeclaredcolor + \def\@declaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@declaredcolor\else\expandafter\pgf@texht@declaredcolor\fi} + \def\@undeclaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@undeclaredcolor\else\expandafter\pgf@texht@undeclaredcolor\fi} + \ConfigureEnv{pgfpicture}{}{}{}{} +} + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def new file mode 100644 index 00000000000..5e3aa27258c --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def @@ -0,0 +1,87 @@ +% 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-textures.def,v 1.5 2007/12/12 16:57:17 tantau Exp $ + + +% Driver commands for textures driver + + +\def\pgfsys@invoke#1{\special{rawpostscript #1}} +\def\pgf@sys@postscript@header#1{\special{prepostscript #1}} +\def\pgf@sys@postscript@object#1{\special{rawpostscript #1}} + + +% +% Load common postscript commands: +% +\input pgfsys-common-postscript.def + + +% +% textures-specific stuff: +% + +\def\pgfsys@beginpicture{% + \special{rawpostscript save}% + \special{rawpostscript save pgfgetcoords}% + \special{postscript}% here come the coordinates + \special{rawpostscript restore}% + \special{rawpostscript pgfbeginpicture}} +\def\pgfsys@endpicture{\special{rawpostscript restore}} +\def\pgfsys@hbox#1{% + \pgfsys@invoke{save pgfbeginhbox}% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1% + \pgfsys@invoke{restore}% +} +\def\pgfsys@begininvisible{% + \special{rawpostscript gsave nulldevice}% +} +\def\pgfsys@endinvisible{% + \special{rawpostscript grestore}% +} +\def\pgfsys@color@unstacked#1{\special{rawpostscript \XC@usecolor{#1}}} + +\def\pgfsys@imagesuffixlist{.epsi:.eps:.ps:} + +\AtBeginDocument{ + % Always present specials. + \special{prepostscript + /pgfsc{}bind def% stroke color is empty by default + /pgffc{}bind def% fill color is empty by default + /pgfe{moveto dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath}bind def% rectangle + /pgfstr{stroke}bind def% + /pgffill{fill}bind def% + /pgfeofill{eofill}bind def% + /pgfw{setlinewidth}bind def% setlinewidth + /pgfgetcoords{/sps{globaldict begin /pgfgy exch def /pgfgx exch def + end pop pop}def/eps{}def userdict begin}bind def + /pgfbeginpicture{/pgfx pgfgx def /pgfy pgfgy def pgfx pgfy translate 1 1 72.27 72 div mul2 neg scale}bind def + /pgfbeginhbox{1 1 72 72.27 div mul2 neg scale + pgfx neg pgfy neg translate + pgffoa .setopacityalpha}bind def% save + /.setopacityalpha where {pop} {/.setopacityalpha{pop}def} ifelse % install .setopacityalpha + /.pgfsetfillopacityalpha{/pgffoa exch def + /pgffill{gsave pgffoa .setopacityalpha fill 1 .setopacityalpha newpath fill grestore}bind def + /pgfeofill{gsave pgffoa .setopacityalpha eofill1 .setopacityalpha newpath eofill grestore}bind def}bind def + /.pgfsetstrokeopacityalpha{/pgfsoa exch def + /pgfstr{gsave pgfsoa .setopacityalpha stroke grestore}bind def}bind def + /pgffoa 1 def + /pgfsoa 1 def + } +} + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def new file mode 100644 index 00000000000..742b4a6fef3 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def @@ -0,0 +1,99 @@ +% 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-vtex.def,v 1.8 2007/12/12 16:57:17 tantau Exp $ + + +% Driver commands for vtex + +% Invoking things: +\def\pgfsys@invoke#1{\special{pS: grestore #1 gsave}} % to protect against things happeing in between +\def\pgfsys@outerinvoke#1{\special{pS: #1}} +\def\pgf@sys@postscript@header#1{\special{pS: #1}} +\def\pgf@sys@postscript@object#1{\special{pS: #1}} + + +% +% Load common postscript commands: +% +\input pgfsys-common-postscript.def + + +% +% vtex-specific stuff: +% + + +% Starting and ending a picture: +\def\pgfsys@beginpicture{\special{pS: + save + /pgfx currentpoint /pgfy exch def def + currentpoint translate + gsave}% + \let\set@color=\pgf@sys@vtex@set@color% + \let\reset@color=\pgf@sys@vtex@reset@color% +} +\def\pgf@sys@vtex@setcolor#1{% + \pgfutil@colorlet{pgf@tempcolor}{#1}% + \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgf@tempcolor}}% + \expandafter\expandafter\expandafter\pgf@sys@vtex@@setcolor\csname\string\color@pgf@tempcolor\endcsname% +} +\def\pgf@sys@vtex@@setcolor#1#2#3#4#5{% + \pgfsysps@color@resetnow% + \expandafter\ifx\csname pgfsys@color@#4\endcsname\relax% + \PackageError{pgfbase}{Unsupported color model `#4'. Sorry}{}% + \else% + \edef\pgf@colmarshal{\expandafter\noexpand\csname pgfsys@color@#4\endcsname}% + \pgf@uncomma#5,,% + \pgf@colmarshal% + \fi} +\def\pgf@sys@vtex@set@color{\pgf@sys@vtex@setcolor{.}\aftergroup\reset@color} +\def\pgf@sys@vtex@reset@color{\pgf@sys@vtex@setcolor{.}} +\def\pgfsys@endpicture{\special{pS: + newpath + grestore + newpath + restore}} + +% Graphics: +\def\pgfsys@imagesuffixlist{.epsi:.eps:.ps:.pdf:} + +% Starting and ending a box: +\def\pgfsys@hbox#1{% + \pgfsys@invoke{save pgfx neg pgfy neg translate}% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1 + \pgfsys@invoke{restore}% +} + +\def\pgfsys@color@unstacked#1{\special{pS: \XC@usecolor{#1}}} + +\def\pgfsys@fill@opacity#1{\pgf@sys@fail{opacity}} +\def\pgfsys@stroke@opacity#1{\pgf@sys@fail{opacity}} + +\AtBeginDocument{ + % Always present specials. + \special{pS: + /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{moveto dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath} bind def% rectangle + /pgfw{setlinewidth} bind def % setlinewidth + } +} + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex new file mode 100644 index 00000000000..e568c4c8c90 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex @@ -0,0 +1,905 @@ +% 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. + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys.code.tex,v 1.31 2008/02/07 19:25:41 tantau Exp $ + + +% Load key mechanism +\input pgfkeys.code.tex + +% "pgf" is a family +\pgfkeys{/pgf/.is family} +\def\pgfset{\pgfqkeys{/pgf}} + +% +% The following conversion functions are used to convert from TeX +% dimensions to postscript/pdf points. +% +{\catcode`\p=12\catcode`\t=12\gdef\Pgf@geT#1pt{#1}} + +\def\pgf@sys@tonumber#1{\expandafter\Pgf@geT\the#1} + +\def\pgf@sys@bp@correct#1{#1=0.99627#1} + +\def\pgf@sys@bp#1{% + {% + \pgf@x=#1\relax% + \pgf@x=0.99627\pgf@x% + \edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}% + \toks@\expandafter\expandafter\expandafter{\expandafter\pgfsysprotocol@currentprotocol\temp}% + \xdef\pgfsysprotocol@currentprotocol{\the\toks@}% + }% +} +\def\pgf@sys@pt#1{% + {% + \pgf@x=#1\relax% + \edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}% + \toks@\expandafter\expandafter\expandafter{\expandafter\pgfsysprotocol@currentprotocol\temp}% + \xdef\pgfsysprotocol@currentprotocol{\the\toks@}% + }% +} + + +% internal dimensions that are always present when pgsys is loaded. +\newdimen\pgf@x +\newdimen\pgf@y +\newdimen\pgf@xa +\newdimen\pgf@ya +\newdimen\pgf@xb +\newdimen\pgf@yb +\newdimen\pgf@xc +\newdimen\pgf@yc + +% internal counters that are alwyas present when pgfsys is loaded +\newcount\c@pgf@counta +\newcount\c@pgf@countb +\newcount\c@pgf@countc +\newcount\c@pgf@countd + + +% The following \if decides, whether even-odd filling and clipping is +% to be used or normal the non-zero winding number rule. See the +% pdf-documentation for details on what these rules are. + +\newif\ifpgfsys@eorule + + + +% In the following dummy definitions of the pgf system commands are +% given. The individual drivers must overwrite these definitions, +% preferably all of them. If some system command is used that has not +% been overwritten, the command fails with a warning. +% +% In some cases, some pgf system commands are just shorthands for a +% series of more complicated commands. In this case, a default +% implementation is given in this file, but a driver may choose to +% overwrite this default implementation with a more effecient +% version. For example, a closestroke is the same as a closepath +% followed by a stroking, but in pdf there is a special shorthand for +% this. So, the pdf driver overwrites \pgfsys@closestroke, while the +% postscript driver does not. +% +% The commands for which default implementations are available are +% given at the end. + +\def\pgf@sys@fail#1{% + \expandafter\ifx\csname pgf@sys@fail@#1\endcsname\pgfutil@empty% + \else% + \expandafter\global\expandafter\let\csname pgf@sys@fail@#1\endcsname=\pgfutil@empty% + \PackageWarning{pgf}{% + Your graphic driver \pgfsysdriver\space does not support #1. This warning is given only once}% + \fi% +} + + + +\def\pgfsys@invoke{\pgf@sys@fail{invoking specials}} +% This command is used whenever some literal text needs to be inserted +% into the resulting .pdf, .ps, or .dvi file. Note that most +% \pgfsys@xxxx commands will not directly call this command, but, +% rather, use the protocolling mechanism to record their literal +% text. It is then left to the discretion of the protocolling +% mechansim to insert the literal text at some appropriate, later +% time. +% +% This command should only be called when \pgfsys@beginpicture has +% been called previously and when the picture has not been suspended +% using \pgfsys@beginhbox. + + +\def\pgfsys@outerinvoke{\pgfsys@invoke} +% This command can be used to insert protocolled graphic commands +% outside any picture. This is extremely dangerous, but sometimes +% useful. By default, this command does the same as inside pictures. + + + +% +% +% Path construction commands +% +% + +\def\pgfsys@moveto#1#2{\pgf@sys@fail{path constructions}} +% This command is used to start a path at a specific point (#1bp,#2bp) +% or to move the current point of the current path to (#1bp,#2bp) +% without drawing anything upon stroking (the current path is +% `interrupted'). +% +% Here (and in the following) the coordinates are in TeX's big points +% (bp), unless the coordinate system has been scaled. A big point is +% 1/72 inches. Note that TeX's point pt is 1/72.27 inches. +% +% Example: +% +% \pgfsys@moveto{10}{10} +% \pgfsys@lineto{0}{0} +% \pgfsys@stroke +% +% This will draw a line from (10bp,10bp) to the origin of the picture. + +\def\pgfsys@lineto#1#2{\pgf@sys@fail{path constructions}} +% Continue the current path to (#1bp,#2bp) with a line. + +\def\pgfsys@curveto#1#2#3#4#5#6{\pgf@sys@fail{path constructions}} +% Continue the current path with a bezier curver to (#5bp,#6bp). The +% control points of the curve are at (#1bp,#2bp) and (#3bp,#4bp). + +\def\pgfsys@rect#1#2#3#4{\pgf@sys@fail{path constructions}} +% Append a rectangle to the current path whose lower left corner is at +% (#1bp,#2bp) and whose width/height is given by (#3bp,#4bp). +% +% This command can be `mapped back' to moveto and lineto commands, but +% it is included since pdf has a special, quick version of this command. + +\def\pgfsys@closepath{\pgf@sys@fail{path constructions}} +% Close the current path. This results in joining the current point of +% the path with the point specified by the last moveto +% operation. Typically, this is preferable over using lineto to the +% last point specified by a moveto, since the line starting at this +% point and the line ending at this point will be smoothly joined by +% closepath. +% +% Example: +% +% \pgfsys@moveto{0}{0} +% \pgfsys@lineto{10}{10} +% \pgfsys@lineto{0}{10} +% \pgfsys@closepath +% \pgfsys@stroke +% +% versus +% +% \pgfsys@moveto{0}{0} +% \pgfsys@lineto{10}{10} +% \pgfsys@lineto{0}{10} +% \pgfsys@lineto{0}{0} +% \pgfsys@stroke +% +% The difference between the above will be that in the second triangle +% the corner at the origin will be wrong; it will just be the overlay +% of two lines going in different directions, not a sharp pointed +% corner. + + + + + + +% +% +% Stroking and filling commands +% +% + +\def\pgfsys@stroke{\pgf@sys@fail{path usage}} +% Stroke the current path (as if it were drawn with a pen). A number +% of so-called graphic state parameters influence this, which can be +% set in different ways: +% +% - linewidth +% The `thickness' of the line. A width of 0 is the thinnest width +% renderable on the device. On a high-resolution printer this may +% become invisible and should be avoided. A good choice is 0.4pt, +% which is the default. +% +% - stroke color +% This special color is used for stroking. If it is not set, the +% current color is used. +% +% - cap +% The cap describes how the endings of lines a drawn. A round cap +% adds a little half circle to these endings. A butt cap ends the +% lines exactly at the end (or start) point without anything +% added. A rectangular cap ends the lines like the butt cap, but the +% lines protrude over the endpoint by the line thickness. (See also +% the pdf or postscript manual). If the path has been closed, no cap +% is drawn. +% +% - join +% This describes how a bend (a join) in a path is rendered. A round +% join draws bends using small arcs. A bevel join just draws the two +% lines and then fills the join minimally so that it becomes +% convex. A miter join extends the lines so that they form a single +% sharp corner, but only up to a certain miter limit. (See the pdf +% or postscript manual once more). +% +% - dash +% The line may be dashed according to a dashing pattern. +% +% - clipping area +% If a clipping area is established, only those parts of the path +% that are inside the clipping area will be drawn. +% +% In addition to stroking a path, the path may also be used for +% clipping after it has been stroked. This will happen if the +% \pgfsys@clipnext is used prior to this command, see there for +% details. + +\def\pgfsys@fill{\pgf@sys@fail{path usage}} +% This command fills the area surrounded by the current path. If the +% path has not yet been closed, it is closed prior to filling. The +% path itself is not stroked. For self-intersecting paths or paths +% consisting of multiple parts, the nonzero winding number rule is +% used to determine whether a point is inside or outside the +% path, except if \ifpgfsys@eorule holds -- in which case the even-odd +% rule should be used. (See the pdf or postscript manual for details.) +% +% The following graphic state parameters influence the filling: +% +% - fill color +% If the fill color is not especially set, the current color is +% used. +% +% - clipping area +% If a clipping area is established, only those parts of the filling +% area that are inside the clipping area will be drawn. +% +% In addition to filling the path, the path will also be used for +% clipping if \pgfsys@clipnext is used prior to this command. + +\def\pgfsys@fillstroke{\pgf@sys@fail{path usage}} +% First, the path is filled, then the path is stroked. If the fill and +% stroke colors are the same (or if they are not specified and the +% current color is used), this yields almost the same as a +% \pgfsys@fill. However, due to the line thickness of the stroked +% path, the fillstroked area will be slightly larger. +% +% In addition to stroking and filling the path, the path will also be +% used for clipping if \pgfsys@clipnext is used prior to this command. + +\def\pgfsys@clipnext{\pgf@sys@fail{path usage}} +% This command should be issued after a path has been constructed, but +% before it has been stroked and/or filled or discarded. When the +% command is used, the next stroking/filling/discarding command will +% first be executed normally. Then, afterwards, the just-used path +% will be used for subsequent clipping. If there has already been a +% clipping region, this region is intersected with the new clipping +% path (the clipping cannot get bigger). The nonzero winding number +% rule is used to determine whether a point is inside or outside the +% clipping area or the even-odd rule, depending on whether +% \ifpgfsys@eorule holds. + +\def\pgfsys@discardpath{\pgf@sys@fail{path usage}} +% Normally, this command should `throw away' the current path. +% However, after \pgfsys@clipnext has been called, the current path +% should subsequently be used for clipping. See \pgfsys@clipnext for +% details. + + + + + +% +% +% Stroking options +% +% +\def\pgfsys@setlinewidth#1{\pgf@sys@fail{setting the line width}} +% Sets the width of lines, when stroked, to #1bp. + +\def\pgfsys@buttcap{\pgf@sys@fail{setting the line cap}} +% Sets the cap to a butt cap. See \pgfsys@stroke. + +\def\pgfsys@roundcap{\pgf@sys@fail{setting the line cap}} +% Sets the cap to a round cap. See \pgfsys@stroke. + +\def\pgfsys@rectcap{\pgf@sys@fail{setting the line cap}} +% Sets the cap to a rectangular cap. See \pgfsys@stroke. + +\def\pgfsys@miterjoin{\pgf@sys@fail{setting the line join}} +% Sets the join to a miter join. See \pgfsys@stroke. + +\def\pgfsys@setmiterlimit#1{\pgf@sys@fail{setting the line cap}} +% Sets the miter limit of lines to #1. See the pdf or postscript +% documentation. + +\def\pgfsys@roundjoin{\pgf@sys@fail{setting the line cap}} +% Sets the join to a round join. See \pgfsys@stroke. + +\def\pgfsys@beveljoin{\pgf@sys@fail{setting the line cap}} +% Sets the join to a bevel join. See \pgfsys@stroke. + +\def\pgfsys@setdash#1#2{\pgf@sys@fail{setting the dashing pattern}} +% Sets the dashing patter. #1 should be a list of lengths given in big +% points (bp) separated by spaces. #2 should be a single value given +% in bp. +% +% The list of values in #1 is used to determine the lengths of the +% `on' phases of the dashing and of the `off' phases. For example, if +% #1 is `3 4', then the dashing pattern is `3bp on followed by 4bp +% off, followed by 3bp on, followed by 4bp off, and so on'. A pattern +% of `.5 4 3 1.5' means `.5bp on, 4bp off, 3bp on, 1.5bp off, .5bp on, +% ...'. If the number of entries is odd, the last one is used twice, +% so `3' means `3bp on, 3bp off, 3bp on, 3bp off,...'. An empty list +% means `always on'. +% +% The second argument determines the `phase' of the pattern. For +% example, for a pattern of `3 4' and a phase of `1', the pattern +% would start: `2bp on, 4bp off, 3bp on, 4bp off, 3bp on, 4bp off...'. + + + + + +% +% +% Color stuff +% +% + +\def\pgfsys@color@rgb@stroke#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given rgb tuple +% (numbers between 0 and 1). +% +% Example: Make stroked text dark red: \pgfsys@color@rgb@stroke{0.5}{0}{0} +% +% The special stroking color is only used if the stroking color has +% been set since the last \pgfutil@color command. Thus, each \pgfutil@color command +% should reset both the stroking and filling colors. + +\def\pgfsys@color@rgb@fill#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given rgb tuple +% (numbers between 0 and 1). This color may be different from the +% stroking color. + +\def\pgfsys@color@rgb#1#2#3{\pgfsys@color@rgb@stroke{#1}{#2}{#3}\pgfsys@color@rgb@fill{#1}{#2}{#3}} +% Sets the color used for filling and stroking operations. This is a +% ``low-level'' version of the \pgfutil@color command. It is currently only +% used by the plain tex version to support colors. + +\def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given cymk tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmyk@fill#1#2#3#4{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given cymk tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmyk#1#2#3#4{\pgfsys@color@cmyk@stroke{#1}{#2}{#3}{#4}\pgfsys@color@cmyk@fill{#1}{#2}{#3}{#4}} +% Sets the color used for filling and stroking operations. + +\def\pgfsys@color@cmy@stroke#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given cym tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmy@fill#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given cym tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmy#1#2#3{\pgfsys@color@cmy@stroke{#1}{#2}{#3}\pgfsys@color@cmy@fill{#1}{#2}{#3}} +% Sets the color used for filling and stroking operations. + +\def\pgfsys@color@gray@stroke#1{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given gray level +% (number between 0 and 1). + +\def\pgfsys@color@gray@fill#1{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given gray level +% (number between 0 and 1). + +\def\pgfsys@color@gray#1{\pgfsys@color@gray@stroke{#1}\pgfsys@color@gray@fill{#1}} +% Sets the color used for filling and stroking operations. + +\newif\ifpgfsys@color@reset@inorder +% This if decides whether the color resetting of the +% \pgfsys@color@reset command may assume that all color commands are +% given ``in order.'' This means that this command will not be called, +% say, at the beginning of a box that is later inserted at a point +% where a fill color was actively set. This may allow the command to +% produce more compact code when it ``knows'' that no special fill or +% stroke color has been set. +\pgfsys@color@reset@inordertrue + + +\def\pgfsys@color@reset{} +% This command will be called when the \pgfutil@color command is used. It +% should purge any internal settings of stroking and filling +% color. After this call, till the next use of a command like +% \pgfsys@color@rgb@fill, the current color installed by the \pgfutil@color +% command should be used. + +\def\pgfsys@color@unstacked#1{} +% This slightly obscure command causes the color stack to be +% tricked. When called, this command should set the current color to +% #1 without causing any change in the color stack. + + + +% +% +% Coordinate system transformations +% +% + +\def\pgfsys@transformcm#1#2#3#4#5#6{\pgf@sys@fail{transformations}} +% Perform a concatenation of the low-level current transformation +% matrix with the matrix given by the values #1 to #6. The +% transformation matrix is a transformation on a homogeneous +% 2D-coordinate system. See the pdf or postscript manual for details. + + + + +% +% +% Graphic state saving and restoring. +% +% + +\def\pgfsys@beginscope{\pgf@sys@fail{scoping}} +% Saves the current graphic state on a graphic state stack. All +% changes to the graphic state parameters mentioned for \pgfsys@stroke +% and \pgfsys@fill will be local to the current graphic state and will +% the old values will be restored after endscope is used. +% +% WARNING: pdf and postscript differ with respect to the question of +% whether the current path is part of the graphic state or not. For +% this reason, you should never use this command unless the path is +% currently empty. For example, it might be a good idea to use +% discardpath prior to calling this command. + +\def\pgfsys@endscope{\pgf@sys@fail{scoping}} +% Restores the last saved graphic state. + + + + +% +% +% Special commands +% +% + +\def\pgfsys@imagesuffixlist{} +% A list of suffixes, separated by `:', that will be tried when +% searching for an image. + + + +% +% +% Transparency +% +% + +\def\pgfsys@stroke@opacity#1{\pgf@sys@fail{opacity}} +% Sets the opacity of stroking operations. 1 means fully opaque, 0 +% means fully transparent. + +\def\pgfsys@fill@opacity#1{\pgf@sys@fail{opacity}} +% Sets the opacity of filling operations. 1 means fully opaque, 0 +% means fully transparent. + +\def\pgfsys@transparencygroupfrombox#1{\pgf@sys@fail{transparency groups}} +% This takes a TeX box and converts it into a transparency +% group. This means that any transparency settings apply to the box as +% a whole. For instance, if a box contains two overlapping black +% circles and you draw them normally with 50% transparency, then the +% overlap will be darker than the rest. By comparison, if the circles +% are part of a transparency group, the overlap will get the same +% color as the rest. + +\def\pgfsys@definemask{\pgf@sys@fail{image masks}} +% This command declares a mask for usage with images. It works similar +% to \pgfsys@defineimage: Certain macros are set when the command is +% called. The result should be to set the macro \pgf@mask to a pdf +% object count that can subsequently be used as a soft mask. The +% following macros will be set when this command is invoked: +% +% - \pgf@filename +% File name of the mask to be defined. +% +% - \pgf@maskmatte +% The so-called matte of the mask (see the pdf documentation for +% details). The matte is a color specification consisting of 1, 3 or +% 4 numbers between 0 and 1. The number of numbers depends on the +% number of color channels in the image (not in the mask!). It will +% be assumed that the image has been preblended with this color. + +\def\pgfsys@fadingfrombox#1#2{\pgf@sys@fail{fadings}} +% Declares an fading named #1. The parameter #2 must be a +% box. Its contents luminosity determines the opacity of the resulting +% mask. + +\def\pgfsys@usefading#1#2#3#4#5#6#7{\pgf@sys@fail{fadings}} +% Installs a previously declared fading #1 in the current graphics +% state. Parameters #2 to #7 specify a transformation cm that should +% be applied to the mask before it is used. + + + +% +% +% Shading commands +% +% + +\def\pgfsys@horishading#1#2#3{\pgf@sys@fail{shadings}\pgf@sys@noshading{#1}} +% Declares a horizontal shading for later use. The effect of this +% command should be the definition of a macro called `@pgfshading#1!' +% (or \csname @pdfshading#1!\endcsname, to be precise). When invoked, +% this new macro should insert a shading at the current position. +% +% #1 is the name of the shading, which is also used in the output +% macro name. #2 is the height of the shading and must be given as a +% TeX dimension like `2cm' or `10pt'. #3 is a shading color +% specification as specified in the pgfuserguide. The shading +% specification implicitly fixes the width of the shading. +% +% When `@pgfshading#1!' is invoked, it should insert a box of height +% #2 and the width implicit in the shading declaration. + +\def\pgfsys@vertshading#1#2#3{\pgf@sys@fail{shadings}\pgf@sys@noshading{#1}} +% Like horishading, only for vertical shadings. This time, the height +% of the shading is implicit in #3 and the width is given as #2. + +\def\pgfsys@radialshading#1#2#3{\pgf@sys@fail{shadings}\pgf@sys@noshading{#1}} +% Declares a radial shading. Like the previous macros, this command +% should setup the macro `@pgfshading#1!', which upon invocation +% should insert a radial shading whose size is implicit in #3. +% +% The parameter #2 is a pgf point specification if the starting point +% of the shading. See the pgfuserguide for details. + +\def\pgfsys@functionalshading#1#2#3#4{\pgf@sys@fail{shadings (functional)}\pgf@sys@noshading{#1}} +% Declares a shading using a PostScript-like function that provides a +% color for each point. Like the previous macros, this command +% should setup the macro `@pgfshading#1!' so that it will produce a +% box containing the desired shading. +% +% Parameter #1 is the name of the shading. Parameter #4 is a +% Postscript-like function (type 4 function of the PDF specification) +% as described in Section 3.9.4 of the PDF Specification version 1.7. +% Parameter #2 and #3 are pgf point specifications that specifies the +% lower left and upper right coordinate. +% +% When function #4 is evaluated, the coordinate of the current +% point will be on the (virtual) PostScript stack in bp units. After +% the function has been evaluated, the stack should consist of three +% numbers (not integers! - the Apple PDF renderer is broken in this +% regard, so add cvr's at the end if needed) that represent the red, +% green, and blue components of the color. +% +% A buggy #4 will result is *totally unpredictable chaos* during +% rendering. + +\def\pgf@sys@noshading#1{\expandafter\global\expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@empty} + + + + +% +% +% Pattern stuff +% +% + +\def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{\pgf@sys@fail{patterns}} +% This command declares a new colored or uncolored pattern. Uncolored +% patterns have no inherent color, the color is provided when they are +% set. Colored patters have an inherent color. +% #1 = name of the pattern (must be a plain suffix for use in +% postscript/pdf/etc.) +% #2 to #5 = four coordinates describing the corners of a bounding box +% of pattern cells +% #6 = x-step +% #7 = y-step +% #8 = pattern code +% #9 = 0 if uncolored patter, 1 if colored pattern. + +\def\pgfsys@setpatternuncolored#1#2#3#4{\pgf@sys@fail{patterns}} +% Sets an uncolored pattern #1 as filling color. The numbers #2, #3, +% #4 must be an rgb-value to be used as the color of the pattern. + +\def\pgfsys@setpatterncolored#1{\pgf@sys@fail{patterns}} +% Sets an colored pattern #1 as filling color. + + +% +% +% Page size stuff +% +% +\def\pgfsys@papersize#1#2{\pgf@sys@fail{papersize}} +% This command sets the paper size in a portable way. +% #1 = width +% #2 = height + + + +% +% +% Position tracking commands +% +% + +% Marks the current position on the page. This position can later be +% referenced using \pgfsys@getposition +\def\pgfsys@markposition#1{\pgf@sys@fail{marking the current position}} + +% Sets #2 to a pgfpoint macro that returns the position #1 is +% returned in a coordinate system where the x-axis goes right and the +% y-axis goes up. The origin of this coordinate system may or may not +% lie in the lower left corner; you should shift the coordinate system +% to the position "pgfpageorigin" to make sure that the origin is at +% the lower left corner. Typically, getting this position +% requires two runs of TeX. On the first run, the macro will be set to +% \relax, indicating that the position is not available. +% +% If #1 is set to the special position "pgfpageorigin", the position +% of the the lower left page corner is returned. + +\def\pgfsys@getposition#1#2{\let#2=\relax} + + + +% +% +% Commands having a default implementation. These commands only need +% not be implemented by drivers if this results in a better +% preformance. +% +% + + +\def\pgfsys@shadingoutsidepgfpicture#1{% + #1% +} +% This command gets the definition of a shading (@pgfshadingxxxx!) as +% an argument and should insert this shading into the normal text. +% +% This command has a default implementation. + + +\def\pgfsys@shadinginsidepgfpicture#1{% + \pgf@makehbox{#1}% + \setbox\pgf@hbox=\hbox{\hskip-.5\wd\pgf@hbox\lower.5\ht\pgf@hbox\hbox{\box\pgf@hbox}}% + \pgfqbox{\pgf@hbox}% +} +% This command works like \pgfsys@shadingoutsidepgfpicture, only it is +% called when a shading should be inserted inside a picture. This +% command should insert the shading centered on the origin (which will +% typically have been low-level translated somewhere else.) +% +% This command has a default implementation. + + + + + +\def\pgfsys@closestroke{\pgfsys@closepath\pgfsys@stroke} +% This command should have the same effect as first closing the path +% and then stroking it. + + +\def\pgfsys@transformshift#1#2{\pgfsys@transformcm{1}{0}{0}{1}{#1}{#2}} +% This command will change the origin of the low-level coordinate +% system to (#1bp,#2bp). + +\def\pgfsys@transformxyscale#1#2{\pgfsys@transformcm{#1}{0}{0}{#2}{0bp}{0bp}} +% This command will scale the low-level coordinate system (and +% everything that is drawn) by a factor of #1 in x-directed and #2 in +% y-direction. Note that this applies to everything, including +% lines. So a scaled line will have a different width and may even +% have a different width when going along the x-axis and when going +% along the y-axis, if the scaling is different in these directions. + +\def\pgfsys@hbox#1{% + \pgfsys@beginscope% + \setbox#1=\hbox{\box#1}% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1% + \pgfsys@endscope% +} +% Called to insert a TeX hbox into a pgfpicture. + +\def\pgfsys@hboxsynced#1{% + {\pgfsys@beginscope\pgflowlevelsynccm\pgfsys@hbox#1\pgfsys@endscope}% +} +% Called to insert a TeX hbox into a pgfpicture, but with the current +% coordinate transformation matrix synced with the canvas +% transformation matrix. +% +% In essence, this command does the same as if you first said +% \pgflowlevelsynccm and then \pgfsys@hbox. However, a driver may +% choose to use a ``TeX-translation'' for the translation part of the +% transformation cm. This will ensure that hyperlinks ``survive'' at +% least translations. + +\def\pgfsys@beginpicture{} +% Called at the beginning of a pgfpicture. Used to setup things. + +\def\pgfsys@endpicture{} +% Called at the end of a pgfpicture. + +\def\pgfsys@typesetpicturebox#1{% + \pgfmathsetlength\pgf@x{\pgf@shift@baseline}% + \advance\pgf@x by-\pgf@picminy\relax% + \advance\pgf@picmaxy by-\pgf@picminy\relax% maxy is now the height + \advance\pgf@picmaxx by-\pgf@picminx\relax% maxx is now the width + \setbox#1=\hbox{\hskip-\pgf@picminx\lower\pgf@picminy\box#1}% + \ht#1=\pgf@picmaxy% + \wd#1=\pgf@picmaxx% + \dp#1=0pt% + \leavevmode\raise-\pgf@x\box#1% +} +% Called after a picture has been typeset in box #1. This +% command should insert the box into the normal TeX code. The box #1 +% will still be a ``raw'' box that contains only the \special's. The +% job of this command is to resize and shift this box according to the +% baseline shift and the size of the box. +% +% This command has a default implementation. + +\def\pgfsys@beginpurepicture{\pgfsys@beginpicture} +% This version of the beginpicture command can be used for pictures +% that are guaranteed not to contain any hboxes. In this case, a +% driver might provide a more compact version of the command. + +\def\pgfsys@endpurepicture{\pgfsys@endpicture} +% Called at the end of a ``pure'' pgfpicture. + +\def\pgfsys@defineimage{% + \ifx\pgf@imagewidth\pgfutil@empty\else\edef\pgf@imagewidth{width=\pgf@imagewidth,}\fi% + \ifx\pgf@imageheight\pgfutil@empty\else\edef\pgf@imageheight{height=\pgf@imageheight,}\fi% + \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepage{page=\pgf@imagepage,}\fi% + \edef\pgf@image{\noexpand\includegraphics[\pgf@imageheight\pgf@imagewidth]{\pgf@filename}}% +} +% Called, when an image should be defined. +% +% This command does not take any parameters. Instead, certain macros +% will be preinstalled with appropriate values when this command is +% invoked. These are: +% +% - \pgf@filename +% File name of the image to be defined. +% +% - \pgf@imagewidth +% Will be set to the desired (scaled) width of the image. +% +% - \pgf@imageheight +% Will be set to the desired (scaled) height of the image. +% +% If this macro and also the height macro are empty, the image +% should have its `natural' size. +% +% If exactly only of them is specified, the undefined value the +% image is scaled so that the aspect ratio is kept. +% +% If both are set, the image is scaled in both directions +% independently, possibly changing the aspect ratio. +% +% +% The following macros presumable mostly make sense for drivers that +% can handle pdf: +% +% - \pgf@imagepage +% The desired page number to be extracted from a multi-page +% `image'. +% +% - \pgf@imagemask +% If set, it will be set to `/SMask x 0 R', where x is the pdf +% object number of a soft mask to be applied to the image. +% +% - \pgf@imageinterpolate +% If set, it will be set to `/Interpolate true' or `/Interpolate +% false', indicating whether the image should be interpolated in +% pdf. +% +% +% The command should now setup the macro \pgf@image such that calling +% this macro will result in typesetting the image. Thus, \pgf@image is +% the `return value' of the command. + + +\def\pgfsys@defobject#1#2#3#4{% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + #4% + \pgfsysprotocol@getcurrentprotocol\pgfsys@@temp% + \expandafter\global\expandafter\let\csname #1\endcsname=\pgfsys@@temp% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp% +} +% Declares an object for later use. The idea is that the object can be +% precached in some way and then be rendered more quickly when used +% several times. For example, an arrow head might be defined and +% prerendered in this way. +% +% The parameter #1 is the name for later use. #2 and #3 are pgf points +% specifying a bounding box for the object. #4 is the code for the +% object. The code may only contain protocollable code. + + +\def\pgfsys@useobject#1#2{% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedfalse% + #2% + \expandafter\pgfsysprotocol@setcurrentprotocol\csname #1\endcsname% + \pgfsysprotocol@invokecurrentprotocol% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp% +} +% Renders a previously declared object. The first parameter is the +% name of the the object. The second parameter is extra code that +% should be executed right *before* the object is rendered. Typically, +% this will be some transformation code. + + +\def\pgfsys@begininvisible{\pgfsys@transformcm{1}{0}{0}{1}{2000bp}{2000bp}} +% Between this command and the closing endinvisible, all output should +% be suppressed. Nothing should be drawn at all, which includes all +% paths, images and shadings. + +\def\pgfsys@endinvisible{\pgfsys@transformcm{1}{0}{0}{1}{-2000bp}{-2000bp}} +% Ends the invisibilty section, unless invisibility blocks have been +% nested. In this case, only the `last' one restores visibility. + + +\def\pgfsys@atbegindocument{} +% This command will be executed at the begin of the document. If for +% whatever reason this is not done, you may wish to execute this +% command yourself. It will setup certain specials that need to be +% inserted into the resulting .pdf/.ps/.xxx file. + + + + + +% Discern the driver: +\input pgf.cfg + +\PackageInfo{pgfsys}{Driver file for pgf: \pgfsysdriver} +\pgfutil@InputIfFileExists{\pgfsysdriver}{}{% + \PackageError{pgfsys}{Driver file ``\pgfsysdriver'' not found.}{}} + + + +% This will insert always-present-specials at the beginning of the +% code. +\AtBeginDocument{ + \pgfsys@atbegindocument + \let\pgfsys@atbegindocument=\pgfutil@empty +} + + + +% Read aux file in plain and context mode: + +\pgfutil@aux@read@hook + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex new file mode 100644 index 00000000000..b34ae3bcdc7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex @@ -0,0 +1,70 @@ +% 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/pgfsysprotocol.code.tex,v 1.4 2006/10/16 22:32:59 tantau Exp $ + + + +% This package provides the pgf system protcol layer. Protocolling is +% used to record a bunch of graphic operations so that they can be +% reused quickly at a later point. +% +% Basically, all ``recordable'' \pgfsys@xxxx commands call +% \pgfsysprotocol@protocol for their protocolable literal +% specials. The literal text will either be stored in the current +% protocol. At a later point (actually, normally this happens +% immediately afterwards), the accumulated protocolled text is invoked +% using pgfsys@invokeprotocol. + + + +\let\pgfsysprotocol@currentprotocol=\pgfutil@empty +\newif\ifpgfsysprotocol@buffered + + +% Add to the protocol buffered +\def\pgfsysprotocol@literalbuffered#1{% + \edef\pgfsysprotocol@temp{{#1\space}}% + \expandafter\pgfutil@g@addto@macro\expandafter\pgfsysprotocol@currentprotocol\pgfsysprotocol@temp% +} + +% Add to the protocol +\def\pgfsysprotocol@literal#1{% + \pgfsysprotocol@literalbuffered{#1}% + \ifpgfsysprotocol@buffered% + \else% + \pgfsysprotocol@flushcurrentprotocol% + \fi% +} + +% Getting and setting the current protocol +\def\pgfsysprotocol@getcurrentprotocol#1{% + \let#1=\pgfsysprotocol@currentprotocol% +} + +\def\pgfsysprotocol@setcurrentprotocol#1{% + \global\let\pgfsysprotocol@currentprotocol=#1% +} + + +% Invoking the current protocol +\def\pgfsysprotocol@invokecurrentprotocol{% + \ifx\pgfsysprotocol@currentprotocol\pgfutil@empty% + \else% + \expandafter\pgfsys@invoke\expandafter{\pgfsysprotocol@currentprotocol}% + \fi% +} + +\def\pgfsysprotocol@flushcurrentprotocol{% + \pgfsysprotocol@invokecurrentprotocol% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex new file mode 100644 index 00000000000..86c7e5691b4 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex @@ -0,0 +1,209 @@ +% 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/pgfsyssoftpath.code.tex,v 1.6 2008/01/23 13:15:28 tantau Exp $ + + +% 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. + + +% Access to the current path: +% +% Lots of stuff is added to the current path and it can get very long +% (containing literally tens of thousands of tokens). For such macros, +% adding things using a simple "g@addtomacro" takes more and more +% time, resulting in quadratic runtime. To avoid this, ideally, one +% would collect things in an array and then use a divide and conquer +% merger. A simple intermediate solution is the following, implemented +% here: We have the path and two buffers. New tokens are added to the +% first buffer, which is quite small. When it overflow, its contents +% is added to the second buffer, which is large. If that buffer +% overflow, the contents is finally added to the main path (which can +% have arbitrary length). Whenever the main path is set or read, the +% buffers are flushed. +% +% Because of this buffering, it is imperative that the main path is +% accessed only vie appropriate interface macros. + + + +% The current path +\let\pgfsyssoftpath@thepath=\pgfutil@empty +\let\pgfsyssoftpath@bigbuffer=\pgfutil@empty +\let\pgfsyssoftpath@smallbuffer=\pgfutil@empty +\newcount\pgfsyssoftpath@smallbuffer@items +\newcount\pgfsyssoftpath@bigbuffer@items + +\def\pgfsyssoftpath@flushbuffers{% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\pgfsyssoftpath@thepath% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter\pgfsyssoftpath@thepath% + \expandafter\pgfsyssoftpath@bigbuffer\pgfsyssoftpath@smallbuffer}% + \global\let\pgfsyssoftpath@smallbuffer=\pgfutil@empty + \global\let\pgfsyssoftpath@bigbuffer=\pgfutil@empty + \global\pgfsyssoftpath@bigbuffer@items0\relax% + \global\pgfsyssoftpath@smallbuffer@items0\relax% +} + +% Getting and setting the current path +\def\pgfsyssoftpath@getcurrentpath#1{% + \pgfsyssoftpath@flushbuffers% + \let#1=\pgfsyssoftpath@thepath% +} + +\def\pgfsyssoftpath@setcurrentpath#1{% + \global\let\pgfsyssoftpath@thepath=#1% + \global\let\pgfsyssoftpath@smallbuffer=\pgfutil@empty + \global\let\pgfsyssoftpath@bigbuffer=\pgfutil@empty + \global\pgfsyssoftpath@bigbuffer@items0\relax% + \global\pgfsyssoftpath@smallbuffer@items0\relax% +} + + +% Invoking the current path (slightly optimized) +\def\pgfsyssoftpath@invokecurrentpath{% + \pgfsyssoftpath@thepath% + \pgfsyssoftpath@bigbuffer% + \pgfsyssoftpath@smallbuffer% +} + +\def\pgfsyssoftpath@flushcurrentpath{% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@setcurrentpath\pgfutil@empty% +} + +% Add an item at the end +\def\pgfsyssoftpath@addtocurrentpath#1{% + \global\advance\pgfsyssoftpath@smallbuffer@items by1\relax% + \ifnum\pgfsyssoftpath@smallbuffer@items<40\relax% good number? + \expandafter\gdef\expandafter\pgfsyssoftpath@smallbuffer\expandafter{\pgfsyssoftpath@smallbuffer#1}% + \else% + \pgfsyssoftpath@smalloverflow{#1}% + \fi% +} +\def\pgfsyssoftpath@smalloverflow#1{% + \global\advance\pgfsyssoftpath@bigbuffer@items by1\relax% + \ifnum\pgfsyssoftpath@smallbuffer@items<30\relax% good number? + \expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\pgfsyssoftpath@bigbuffer% + \expandafter\expandafter\expandafter{\expandafter\pgfsyssoftpath@bigbuffer\pgfsyssoftpath@smallbuffer#1}% + \global\let\pgfsyssoftpath@smallbuffer=\pgfutil@empty% + \global\pgfsyssoftpath@smallbuffer@items0\relax% + \else% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\pgfsyssoftpath@thepath% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter\pgfsyssoftpath@thepath + \expandafter\pgfsyssoftpath@bigbuffer\pgfsyssoftpath@smallbuffer#1}% + \global\let\pgfsyssoftpath@smallbuffer=\pgfutil@empty + \global\let\pgfsyssoftpath@bigbuffer=\pgfutil@empty + \global\pgfsyssoftpath@bigbuffer@items0\relax% + \global\pgfsyssoftpath@smallbuffer@items0\relax% + \fi% +} + + + +\def\pgfsyssoftpath@lastmoveto{{0pt}{0pt}} + +\newif\ifpgfsyssoftpathmovetorelevant +\pgfsyssoftpathmovetorelevanttrue + +% Add a moveto element to the current path +\def\pgfsyssoftpath@moveto#1#2{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@movetotoken{#1}{#2}% + }}% + \expandafter\pgfsyssoftpath@addtocurrentpath\pgfsyssoftpath@temp% + \ifpgfsyssoftpathmovetorelevant% + \xdef\pgfsyssoftpath@lastmoveto{{#1}{#2}}% + \fi% +} + +% Add a lineto element to the current path +\def\pgfsyssoftpath@lineto#1#2{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@linetotoken{#1}{#2}% + }}% + \expandafter\pgfsyssoftpath@addtocurrentpath\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\pgfsyssoftpath@addtocurrentpath\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\pgfsyssoftpath@addtocurrentpath\pgfsyssoftpath@temp% +} + +% Add closepath element to the current path +\def\pgfsyssoftpath@closepath{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@closepathtoken\pgfsyssoftpath@lastmoveto% + }}% + \expandafter\pgfsyssoftpath@addtocurrentpath\pgfsyssoftpath@temp% +} + +% Add special element to the current path +\def\pgfsyssoftpath@specialround#1#2{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@specialroundtoken{#1}{#2}% + }}% + \expandafter\pgfsyssoftpath@addtocurrentpath\pgfsyssoftpath@temp% +} + +% 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=\pgfutil@gobbletwo + + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: |