summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pgf-cmykshadings/pgfsys-cmykshadings-pdftex.def
blob: 6073ffea8e28611f25363b568bab277ac698a7be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
%%
%% This is file `pgfsys-cmykshadings-pdftex.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pgf-cmykshadings.dtx  (with options: `pdftex-driver')
%% 
%% This is a generated file.
%% 
%% Copyright (c) 2018 David Purton <dcpurton@marshwiggle.net>
%% 
%% This work may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3c of this license
%% or (at your option) any later version. The latest version of this
%% license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% This work is "maintained" (as per the LPPL maintenance status)
%% by David Purton.
%% 
%% This work consists of the files pgf-cmykshadings.ins,
%% pgf-cmykshadings.dtx, README.md, and the derived files
%%   - pgf-cmykshadings.sty
%%   - pgfsys-cmykshadings-pdftex.def
%%   - pgfsys-cmykshadings-xetex.def
%%   - pgfsys-cmykshadings-luatex.def
%%   - pgfsys-cmykshadings-dvipdfmx.def
%%   - pgfsys-cmykshadings-dvipdfm.def
%%   - pgfsys-cmykshadings-dvips.def
%%   - pgfsys-cmykshadings-textures.def
%%   - pgfsys-cmykshadings-vtex.def
%%   - pgfsys-cmykshadings-common-postscript.def
%%   - pgf-cmykshadings.pdf
%% 
%% 
%% Substantial parts of the code for this package are taken from the pgf package
%% file pgfcoreshade.code.tex, along with the driver files pgfsys-*.def, copyright
%% (c) 2006 Till Tantau and then slightly modified to support CMYK and grayscale
%% shadings.
%% 
\ProvidesFile{pgfsys-cmykshadings-pdftex.def}%
  [2018/10/24
   CMYK and grayscale shadings support for PGF pdftex driver (DCP)]
\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}}%
    \immediate\pdfxform resources {%
      /Shading << /Sh << /ShadingType 2
      /ColorSpace \pgf@shading@device\space
      /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}%
    \expandafter\xdef\csname @pgfshading#1@model!\endcsname{%
      \pgf@shading@model}%
  }%
}
\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}}%
    \immediate\pdfxform resources {%
      /Shading << /Sh << /ShadingType 2
      /ColorSpace \pgf@shading@device\space
      /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}%
    \expandafter\xdef\csname @pgfshading#1@model!\endcsname{%
      \pgf@shading@model}%
  }%
}
\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}%
    \immediate\pdfxform resources {%
      /Shading << /Sh << /ShadingType 3
      /ColorSpace \pgf@shading@device\space
      /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}%
    \expandafter\xdef\csname @pgfshading#1@model!\endcsname{%
      \pgf@shading@model}%
  }%
}
\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 [\pgf@shading@functional@range]
    }
    {{#4}}%
    \edef\pgf@temp@num{\the\pdflastobj}%
    \pdfxform resources {%
      /Shading << /Sh << /ShadingType 1
      /ColorSpace \pgf@shading@device\space
      /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%
    }%
    \expandafter\xdef\csname @pgfshading#1@model!\endcsname{%
      \pgf@shading@model}%
  }%
}
%% 
%%
%% End of file `pgfsys-cmykshadings-pdftex.def'.