summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgpgf.xmt
blob: 7a3e688e6ee31428418291ade8505c554b578072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
\DeclareNamespace{svg}{http://www.w3.org/2000/svg}

\XMLelement{svg:svg}{
}
{\begin{pgfpicture}
  \pgfsetyvec{\pgfpoint{0cm}{-1cm}}}
{\end{pgfpicture}}

\XMLelement{svg:rect}{
  \XMLattribute{width}{\svgwidth}{0}
  \XMLattribute{height}{\svgheight}{0}
  \XMLattribute{x}{\svgx}{0}
  \XMLattribute{y}{\svgy}{0}
  \XMLattribute{fill}{\svgfill}{x000}
}	
{
  \expandafter\svgparsefill\svgfill
  \pgfsetfillcolor{mycol}
  \pgfpathrectangle{\pgfpointxy{\svgx}{\svgy}}{\pgfpointxy{\svgwidth}{\svgheight}}
  \pgfusepath{fill}}
{}

\gdef\svgparsefill#1#2#3#4{%
  \pgfmathparse{\csname tonum#2\endcsname/16}
  \let\myred=\pgfmathresult
  \pgfmathparse{\csname tonum#3\endcsname/16}
  \let\mygreen=\pgfmathresult
  \pgfmathparse{\csname tonum#4\endcsname/16}
  \let\myblue=\pgfmathresult
  \definecolor{mycol}{rgb}{\myred,\mygreen,\myblue}
}

\expandafter\gdef\csname tonum0\endcsname{0}
\expandafter\gdef\csname tonum1\endcsname{1}
\expandafter\gdef\csname tonum2\endcsname{2}
\expandafter\gdef\csname tonum3\endcsname{3}
\expandafter\gdef\csname tonum4\endcsname{4}
\expandafter\gdef\csname tonum5\endcsname{5}
\expandafter\gdef\csname tonum6\endcsname{6}
\expandafter\gdef\csname tonum7\endcsname{7}
\expandafter\gdef\csname tonum8\endcsname{8}
\expandafter\gdef\csname tonum9\endcsname{9}
\expandafter\gdef\csname tonuma\endcsname{10}
\expandafter\gdef\csname tonumb\endcsname{11}
\expandafter\gdef\csname tonumc\endcsname{12}
\expandafter\gdef\csname tonumd\endcsname{13}
\expandafter\gdef\csname tonume\endcsname{14}
\expandafter\gdef\csname tonumf\endcsname{15}