diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def | 97 |
1 files changed, 76 insertions, 21 deletions
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 index 0046ff5a2c1..03a422f95e1 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def @@ -1,18 +1,20 @@ -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-svg.def,v 1.13 2005/11/15 17:46:37 tantau Exp $ - -% Copyright 2005 by Till Tantau <tantau@cs.tu-berlin.de>. +% Copyright 2006 by Till Tantau % -% This program can be redistributed and/or modified under the terms -% of the GNU Public License, version 2. - +% 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.17 2006/10/11 15:22:26 tantau Exp $ % Driver commands for svg % Helping functions: -\let\pgf@sys@svgpath=\@empty +\let\pgf@sys@svgpath=\pgf@empty \def\pgf@sys@svgnum#1{% {% \pgf@x=#1\relax% @@ -22,12 +24,12 @@ }% } \def\pgf@sys@addtosvgpath#1{\g@addto@macro\pgf@sys@svgpath{#1\space}} -\def\pgf@sys@flushsvgpath{\pgfsysprotocol@literal{\pgf@sys@svgpath}\global\let\pgf@sys@svgpath=\@empty} +\def\pgf@sys@flushsvgpath{\pgfsysprotocol@literal{\pgf@sys@svgpath}\global\let\pgf@sys@svgpath=\pgf@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=\@empty +\let\Hnewline=\pgf@empty % Path construction: \def\pgfsys@lineto#1#2{\pgf@sys@addtosvgpath{L }\pgf@sys@svgnum{#1}\pgf@sys@svgnum{#2}} @@ -77,7 +79,7 @@ \pgf@sys@svg@gs{clip-path="url(\#pgfcp\the\pgf@sys@svg@objectcount)"} \pgf@sys@svg@clipnextfalse% \else% - \global\let\pgf@sys@svgpath=\@empty + \global\let\pgf@sys@svgpath=\pgf@empty \fi} % Fill rules: @@ -114,7 +116,7 @@ % Graphics state \def\pgfsys@setdash#1#2{% \edef\pgf@test@dashpattern{#1}% - \ifx\pgf@test@dashpattern\@empty% + \ifx\pgf@test@dashpattern\pgf@empty% \pgf@sys@svg@gs{stroke-dasharray="none" stroke-dashoffset="#2"}% \else% \pgf@sys@svg@gs{stroke-dasharray="#1" stroke-dashoffset="#2"}% @@ -191,30 +193,34 @@ }% } +\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{stroke="\pgf@sys@svg@prepared"}} + \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{fill="\pgf@sys@svg@prepared"}} + \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{stroke="\pgf@sys@svg@prepared"}} + \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{fill="\pgf@sys@svg@prepared"}} + \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{stroke="\pgf@sys@svg@prepared"}} + \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{fill="\pgf@sys@svg@prepared"}} + \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{stroke="\pgf@sys@svg@prepared"}} + \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{fill="\pgf@sys@svg@prepared"}} + \pgf@sys@svg@gs@color{fill="\pgf@sys@svg@prepared"}} % Shadings: @@ -231,7 +237,7 @@ } \def\pgf@sys@svg@shading@dostops#1{% \edef\pgf@test{#1}% - \ifx\pgf@test\@empty% + \ifx\pgf@test\pgf@empty% \else% \expandafter\pgf@sys@svg@shading@dostop\pgf@test% \expandafter\pgf@sys@svg@shading@dostops% @@ -255,7 +261,7 @@ \pgf@sys@svg@addtostops{\pgf@sys@svg@prepared}% } -\let\pgf@sys@svg@thestops=\@empty +\let\pgf@sys@svg@thestops=\pgf@empty \def\pgf@sys@svg@addtostops#1{% \edef\pgf@temp{#1}% \expandafter\expandafter\expandafter\def @@ -345,6 +351,55 @@ } +% 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 |