%%
%% This is file `pgf-cmykshadings.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pgf-cmykshadings.dtx  (with options: `package')
%% 
%% 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-cmykshadgins-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.
%% 
\ProvidesPackage{pgf-cmykshadings}%
  [2018/10/23 CMYK shadings support for PGF (DCP)]
\RequirePackage{pgf}
\def\pgf@parsefunc#1{%
  \edef\temp{{#1}}%
  \expandafter\pgf@convertstring\temp%
  \edef\temp{{\pgf@conv}}%
  \expandafter\pgf@@parsefunc\temp}
\def\pgf@@parsefunc#1{%
  \let\pgf@bounds=\pgfutil@empty%
  \let\pgf@funcs=\pgfutil@empty%
  \let\pgf@psfuncs=\pgfutil@empty%
  \let\pgf@encode=\pgfutil@empty%
  \let\pgf@sys@shading@ranges=\pgfutil@empty%
  \pgf@sys@shading@range@num=0\relax%
  \csname pgf@parsefirst\pgf@shading@model\endcsname[#1; ]%
  \csname pgf@parselastdom\pgf@shading@model\endcsname[#1; ]%
  \csname pgf@parsemid\pgf@shading@model\endcsname[#1; ]%
  \ifx\pgf@bounds\pgfutil@empty%
    \edef\pgf@pdfparseddomain{0 1}%
    \edef\pgf@pdfparsedfunction{\pgf@singlefunc\space}%
  \else%
    \edef\pgf@pdfparseddomain{\pgf@doma\space\pgf@domb}%
    \edef\pgf@pdfparsedfunction{%
      << /FunctionType 3 /Domain [\pgf@doma\space\pgf@domb] /Functions
      [\pgf@funcs\space] /Bounds [\pgf@bounds] /Encode [0 1 \pgf@encode]
      >> }% <<
  \fi%
  \xdef\pgf@psfuncs{\pgf@psfuncs}%
  }
\let\pgf@parsefirstrgb\pgf@parsefirst
\let\pgf@parselastdomrgb\pgf@parselastdom
\let\pgf@parsemidrgb\pgf@parsemid
\let\pgf@parserestrgb\pgf@parserest
\def\pgf@parsefirstcmyk[cmyk(#1)=(#2,#3,#4,#5)#6]{%
  \pgfmathsetlength\pgf@x{#1}%
  \edef\pgf@sys@shading@start@pos{\the\pgf@x}%
  \pgf@sys@bp@correct\pgf@x%
  \edef\pgf@doma{\pgf@sys@tonumber{\pgf@x}}%
  \edef\pgf@prevx{\pgf@sys@tonumber{\pgf@x}}%
  \pgf@getcmyktuplewithmixin{#2}{#3}{#4}{#5}%
  \edef\pgf@sys@shading@start@cmyk{\pgf@sys@cmyk}%
  \let\pgf@sys@prevcolor=\pgf@sys@shading@start@cmyk%
  \let\pgf@sys@prevpos=\pgf@sys@shading@start@pos%
  \edef\pgf@prevcolor{\pgf@cmyk}%
  \edef\pgf@firstcolor{\pgf@cmyk}}
\def\pgf@parselastdomcmyk[cmyk(#1)=(#2,#3,#4,#5); {%
  \pgfutil@ifnextchar]{%
    \pgfmathsetlength\pgf@x{#1}%
    \edef\pgf@sys@shading@end@pos{\the\pgf@x}%
    \pgf@max=\pgf@x\relax%
    \pgf@sys@bp@correct\pgf@x%
    \edef\pgf@domb{\pgf@sys@tonumber{\pgf@x}}%
    \pgf@getcmyktuplewithmixin{#2}{#3}{#4}{#5}%
    \edef\pgf@sys@shading@end@cmyk{\pgf@sys@cmyk}%
    \pgfutil@gobble}{\pgf@parselastdomcmyk[}}
\def\pgf@parsemidcmyk[cmyk(#1)=(#2,#3,#4,#5); {\pgf@parserestcmyk[}
\def\pgf@parserestcmyk[cmyk(#1)=(#2,#3,#4,#5); {%
  \advance\pgf@sys@shading@range@num by1\relax%
  \pgfutil@ifnextchar]{%
    \pgf@getcmyktuplewithmixin{#2}{#3}{#4}{#5}%
    \edef\pgf@singlefunc{\space%
      << /FunctionType 2 /Domain [0 1] /C0
      [\pgf@prevcolor] /C1 [\pgf@cmyk] /N 1 >> }% <<
    \edef\pgf@funcs{\pgf@funcs\space%
      << /FunctionType 2 /Domain [\pgf@doma\space\pgf@domb] /C0
      [\pgf@prevcolor] /C1 [\pgf@cmyk] /N 1 >> }% <<
    \edef\pgf@psfuncs{\pgf@prevx\space
      \pgf@cmyk\space \pgf@prevcolor\space pgfshade \pgf@psfuncs}%
    \pgfmathsetlength\pgf@x{#1}%
    \edef\pgf@sys@shading@ranges{\pgf@sys@shading@ranges{%
      {\pgf@sys@prevpos}{\the\pgf@x}{\pgf@sys@prevcolor}{\pgf@sys@cmyk}}}%
    \edef\pgf@sys@prevpos{\the\pgf@x}%
    \let\pgf@sys@prevcolor=\pgf@sys@cmyk%
    \pgfutil@gobble}{%
    \pgfmathsetlength\pgf@x{#1}%
    \pgf@getcmyktuplewithmixin{#2}{#3}{#4}{#5}%
    \edef\pgf@sys@shading@ranges{\pgf@sys@shading@ranges{%
      {\pgf@sys@prevpos}{\the\pgf@x}{\pgf@sys@prevcolor}{\pgf@sys@cmyk}}}%
    \edef\pgf@sys@prevpos{\the\pgf@x}%
    \let\pgf@sys@prevcolor=\pgf@sys@cmyk%
    \edef\pgf@psfuncs{\pgf@prevx\space \pgf@cmyk\space
      \pgf@prevcolor\space pgfshade \pgf@psfuncs}%
    \pgf@sys@bp@correct\pgf@x%
    \edef\pgf@prevx{\pgf@sys@tonumber{\pgf@x}}%
    \edef\pgf@bounds{\pgf@bounds\space\pgf@sys@tonumber{\pgf@x}}%
    \edef\pgf@encode{\pgf@encode\space0 1}%
    \edef\pgf@singlefunc{\space%
      << /FunctionType 2 /Domain [0 1] /C0
      [\pgf@prevcolor] /C1 [\pgf@cmyk] /N 1 >> }% <<
    \edef\pgf@funcs{\pgf@funcs\space%
      << /FunctionType 2 /Domain [\pgf@doma\space\pgf@domb] /C0
      [\pgf@prevcolor] /C1 [\pgf@cmyk] /N 1 >> }% <<
    \edef\pgf@prevcolor{\pgf@cmyk}%
    \pgf@parserestcmyk[}}
\def\pgf@getcmyktuplewithmixin#1#2#3#4{%
  \pgfutil@definecolor{pgfshadetemp}{cmyk}{#1,#2,#3,#4}%
  \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgfshadetemp}}%
  \pgfutil@extractcolorspec{pgfshadetemp}{\pgf@tempcolor}%
  \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{cmyk}{\pgf@cmykcolor}%
  \expandafter\pgf@getcmyk@@\pgf@cmykcolor!}
\def\pgf@getcmyk@@#1,#2,#3,#4!{%
  \def\pgf@cmyk{#1 #2 #3 #4}%
  \def\pgf@sys@cmyk{{#1}{#2}{#3}{#4}}%
}
\def\pgf@parsefirstgray[gray(#1)=(#2)#3]{%
  \pgfmathsetlength\pgf@x{#1}%
  \edef\pgf@sys@shading@start@pos{\the\pgf@x}%
  \pgf@sys@bp@correct\pgf@x%
  \edef\pgf@doma{\pgf@sys@tonumber{\pgf@x}}%
  \edef\pgf@prevx{\pgf@sys@tonumber{\pgf@x}}%
  \pgf@getgraytuplewithmixin{#2}%
  \edef\pgf@sys@shading@start@gray{\pgf@sys@gray}%
  \let\pgf@sys@prevcolor=\pgf@sys@shading@start@gray%
  \let\pgf@sys@prevpos=\pgf@sys@shading@start@pos%
  \edef\pgf@prevcolor{\pgf@gray}%
  \edef\pgf@firstcolor{\pgf@gray}}
\def\pgf@parselastdomgray[gray(#1)=(#2); {%
  \pgfutil@ifnextchar]{%
    \pgfmathsetlength\pgf@x{#1}%
    \edef\pgf@sys@shading@end@pos{\the\pgf@x}%
    \pgf@max=\pgf@x\relax%
    \pgf@sys@bp@correct\pgf@x%
    \edef\pgf@domb{\pgf@sys@tonumber{\pgf@x}}%
    \pgf@getgraytuplewithmixin{#2}%
    \edef\pgf@sys@shading@end@gray{\pgf@sys@gray}%
    \pgfutil@gobble}{\pgf@parselastdomgray[}}
\def\pgf@parsemidgray[gray(#1)=(#2); {\pgf@parserestgray[}
\def\pgf@parserestgray[gray(#1)=(#2); {%
  \advance\pgf@sys@shading@range@num by1\relax%
  \pgfutil@ifnextchar]{%
    \pgf@getgraytuplewithmixin{#2}%
    \edef\pgf@singlefunc{\space%
      << /FunctionType 2 /Domain [0 1] /C0
      [\pgf@prevcolor] /C1 [\pgf@gray] /N 1 >> }% <<
    \edef\pgf@funcs{\pgf@funcs\space%
      << /FunctionType 2 /Domain [\pgf@doma\space\pgf@domb] /C0
      [\pgf@prevcolor] /C1 [\pgf@gray] /N 1 >> }% <<
    \edef\pgf@psfuncs{\pgf@prevx\space \pgf@gray\space
      \pgf@prevcolor\space pgfshade \pgf@psfuncs}%
    \pgfmathsetlength\pgf@x{#1}%
    \edef\pgf@sys@shading@ranges{\pgf@sys@shading@ranges{%
      {\pgf@sys@prevpos}{\the\pgf@x}{\pgf@sys@prevcolor}{\pgf@sys@gray}}}%
    \edef\pgf@sys@prevpos{\the\pgf@x}%
    \let\pgf@sys@prevcolor=\pgf@sys@gray%
    \pgfutil@gobble}{%
    \pgfmathsetlength\pgf@x{#1}%
    \pgf@getgraytuplewithmixin{#2}%
    \edef\pgf@sys@shading@ranges{\pgf@sys@shading@ranges{%
      {\pgf@sys@prevpos}{\the\pgf@x}{\pgf@sys@prevcolor}{\pgf@sys@gray}}}%
    \edef\pgf@sys@prevpos{\the\pgf@x}%
    \let\pgf@sys@prevcolor=\pgf@sys@gray%
    \edef\pgf@psfuncs{\pgf@prevx\space \pgf@gray\space
      \pgf@prevcolor\space pgfshade \pgf@psfuncs}%
    \pgf@sys@bp@correct\pgf@x%
    \edef\pgf@prevx{\pgf@sys@tonumber{\pgf@x}}%
    \edef\pgf@bounds{\pgf@bounds\space\pgf@sys@tonumber{\pgf@x}}%
    \edef\pgf@encode{\pgf@encode\space0 1}%
    \edef\pgf@singlefunc{\space%
      << /FunctionType 2 /Domain [0 1] /C0
      [\pgf@prevcolor] /C1 [\pgf@gray] /N 1 >> }% <<
    \edef\pgf@funcs{\pgf@funcs\space%
      << /FunctionType 2 /Domain [\pgf@doma\space\pgf@domb] /C0
      [\pgf@prevcolor] /C1 [\pgf@gray] /N 1 >> }% <<
    \edef\pgf@prevcolor{\pgf@gray}%
    \pgf@parserestgray[}}
\def\pgf@getgraytuplewithmixin#1{%
  \pgfutil@definecolor{pgfshadetemp}{gray}{#1}%
  \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgfshadetemp}}%
  \pgfutil@extractcolorspec{pgfshadetemp}{\pgf@tempcolor}%
  \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{gray}{\pgf@graycolor}%
  \expandafter\pgf@getgray@@\pgf@graycolor!}
\def\pgf@getgray@@#1!{%
  \def\pgf@gray{#1}%
  \def\pgf@sys@gray{{#1}}%
}
\def\pgf@convertstring#1{%
  \def\pgf@conv{}%
  \pgf@convert#1]%
  }
\def\pgf@convert{%
  \pgfutil@ifnextchar]{\pgfutil@gobble}%done!
  {%
    \pgfutil@ifnextchar;{\pgf@grabsemicolor}%
    {%
      \pgfutil@ifnextchar c{\pgf@gobblec}%
      {%
        \pgfutil@ifnextchar g{\pgf@grabgray}%
        {%
          \pgfutil@ifnextchar o{\pgf@grabcolor}%
          {%
            \pgfutil@ifnextchar m{\pgf@grabcmyk}%
            {%
              \pgfutil@ifnextchar r{\pgf@grabrgb}%
                {\pgferror{Illformed shading
                 specification}\pgf@convert}%
            }%
          }%
        }%
      }%
    }%
  }%
}
\def\pgf@grabsemicolor;{%
  \edef\pgf@conv{\pgf@conv; }\pgf@convert}
\def\pgf@gobblec c{\pgf@convert}
\def\pgf@savecolor#1{
  \pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}%
  \expandafter\pgfutil@convertcolorspec\pgf@tempcolor%
    {\pgf@shading@model}{\pgf@color}%
  \expandafter\pgf@convget@\expandafter{\pgf@color}{#1}%
}
\def\pgf@grabrgb rgb(#1)=(#2,#3,#4){%
  \pgfutil@definecolor{pgf@tempcol}{rgb}{#2,#3,#4}%
  \pgf@savecolor{#1}%
}
\def\pgf@grabcmyk myk(#1)=(#2,#3,#4,#5){%
  \pgfutil@definecolor{pgf@tempcol}{cmyk}{#2,#3,#4,#5}%
  \pgf@savecolor{#1}%
}
\def\pgf@grabgray gray(#1)=(#2){%
  \pgfutil@definecolor{pgf@tempcol}{gray}{#2}%
  \pgf@savecolor{#1}%
}
\def\pgf@grabcolor olor(#1)=(#2){%
  \pgfutil@colorlet{pgf@tempcol}{#2}%
  \pgf@savecolor{#1}%
}
\def\pgf@convget@#1#2{%
  \edef\pgf@conv{\pgf@conv \pgf@shading@model(#2)=(#1)}\pgf@convert}
\newdimen\pgf@xd
\def\pgfshadecolortocmyk#1#2{%
  \pgfutil@colorlet{pgf@tempcol}{#1}%
  \pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}%
  \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{cmyk}{\pgf@cmykcolor}%
  \expandafter\pgfshading@cmyk\pgf@cmykcolor\relax%
  \edef#2{\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space
    \pgf@sys@tonumber{\pgf@xc}\space\pgf@sys@tonumber{\pgf@xd}\space}%
  \c@pgf@counta\escapechar%
  \escapechar-1\relax%
  \expandafter\edef\csname\string#2cyan\endcsname{%
    \pgf@sys@tonumber{\pgf@xa}\space}%
  \expandafter\edef\csname\string#2magenta\endcsname{%
    \pgf@sys@tonumber{\pgf@xb}\space}%
  \expandafter\edef\csname\string#2yellow\endcsname{%
    \pgf@sys@tonumber{\pgf@xc}\space}%
  \expandafter\edef\csname\string#2black\endcsname{%
    \pgf@sys@tonumber{\pgf@xd}\space}%
  \escapechar\c@pgf@counta%
}
\def\pgfshading@cmyk#1,#2,#3,#4\relax{%
  \pgf@xa=#1pt%
  \pgf@xb=#2pt%
  \pgf@xc=#3pt%
  \pgf@xd=#4pt%
}
\def\pgfshadecolortogray#1#2{%
  \pgfutil@colorlet{pgf@tempcol}{#1}%
  \pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}%
  \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{gray}{\pgf@graycolor}%
  \expandafter\pgfshading@gray\pgf@graycolor\relax%
  \edef#2{\pgf@sys@tonumber{\pgf@xa}\space}%
  \c@pgf@counta\escapechar%
  \escapechar-1\relax%
  \expandafter\edef\csname\string#2gray\endcsname{%
    \pgf@sys@tonumber{\pgf@xa}\space}%
  \escapechar\c@pgf@counta%
}
\def\pgfshading@gray#1\relax{%
  \pgf@xa=#1pt%
}
\def\pgfdeclarehorizontalshading{%
  \pgf@setup@model
  \pgfutil@ifnextchar[%
    \pgf@declarehorizontalshading{\pgf@declarehorizontalshading[]}}
\def\pgfdeclareverticalshading{%
  \pgf@setup@model
  \pgfutil@ifnextchar[%
    \pgf@declareverticalshading{\pgf@declareverticalshading[]}}
\def\pgfdeclareradialshading{%
  \pgf@setup@model
  \pgfutil@ifnextchar[%
    \pgf@declareradialshading{\pgf@declareradialshading[]}}
\def\pgfdeclarefunctionalshading{%
  \pgf@setup@model
  \pgfutil@ifnextchar[
    \pgf@declarefunctionalshading{\pgf@declarefunctionalshading[]}}
\def\pgfuseshading#1{%
  \edef\pgf@shadingname{@pgfshading#1}%
  \edef\pgf@shadingsavedmodel{@pgfshading#1@model}%
  \pgf@tryextensions{\pgf@shadingname}{\pgfalternateextension}%
  \expandafter\pgfutil@ifundefined\expandafter{\pgf@shadingname}%
  {\pgferror{Undefined shading "#1"}}%
  {%
    {%
      \pgf@setup@model
      \pgfutil@globalcolorsfalse%
      \def\pgf@shade@adds{}%
      \pgfutil@ifundefined{pgf@deps\pgf@shadingname}%
      {}%
      {%
        \edef\@list{\csname pgf@deps\pgf@shadingname\endcsname}%
        \pgfutil@for\@temp:=\@list\do{%
          {%
            \pgfutil@ifundefined{applycolormixins}%
              {}{\applycolormixins{\@temp}}%
            \pgfutil@extractcolorspec{\@temp}{\pgf@tempcolor}%
            \expandafter\pgfutil@ifundefined\expandafter{%
              \pgf@shadingsavedmodel}
              {\expandafter\pgfutil@convertcolorspec\pgf@tempcolor{%
                 \pgf@shading@model}{\pgf@color}}%
              {\expandafter\pgfutil@convertcolorspec\pgf@tempcolor{%
                 \pgf@shadingsavedmodel}{\pgf@color}}%
            \xdef\pgf@shade@adds{\pgf@shade@adds,\pgf@color}%
          }%
        }%
      }%
      \expandafter\pgf@strip@shadename\pgf@shadingname!!%
      \pgfutil@ifundefined{@pgfshading\pgf@basename\pgf@shade@adds!}%
      {%
        {%
          \expandafter\def\expandafter\@temp\expandafter{%
            \csname pgf@func\pgf@shadingname\endcsname}%
          \edef\@args{{\pgf@basename\pgf@shade@adds}}%
          \expandafter\expandafter\expandafter\def%
          \expandafter\expandafter\expandafter\@@args%
          \expandafter\expandafter\expandafter{%
            \csname pgf@args\pgf@shadingname\endcsname}%
          \expandafter\expandafter\expandafter\@temp
            \expandafter\@args\@@args%
        }%
      }%
      {}%
      \pgf@invokeshading{%
        \csname @pgfshading\pgf@basename\pgf@shade@adds!\endcsname}%
    }%
  }%
}
\newif\ifpgfshadingmodelrgb
\newif\ifpgfshadingmodelcmyk
\newif\ifpgfshadingmodelgray
\def\pgf@setup@model{%
  \pgfshadingmodelrgbtrue
  \pgfshadingmodelcmykfalse
  \pgfshadingmodelgrayfalse
  \XC@sdef\pgf@mod@test{\XC@tgt@mod{natural}}%
  \def\pgf@shading@functional@range{0 1 0 1 0 1}%
  \def\pgf@shading@device{/DeviceRGB}%
  \def\pgf@shading@ps@device{setrgbcolor}%
  \def\pgf@shading@model{rgb}%
  \ifx\pgf@mod@test\XC@mod@natural
    \ifpgfcmykshadingdefault
      \def\pgf@shading@functional@range{0 1 0 1 0 1 0 1}%
      \def\pgf@shading@device{/DeviceCMYK}%
  \def\pgf@shading@ps@device{setcmykcolor}%
      \def\pgf@shading@model{cmyk}%
      \pgfshadingmodelrgbfalse
      \pgfshadingmodelcmyktrue
    \else
      \def\pgf@shading@functional@range{0 1 0 1 0 1}%
      \def\pgf@shading@device{/DeviceRGB}%
      \def\pgf@shading@ps@device{setrgbcolor}%
      \def\pgf@shading@model{rgb}%
    \fi
  \fi
  \ifx\pgf@mod@test\XC@mod@cmyk
    \def\pgf@shading@functional@range{0 1 0 1 0 1 0 1}%
    \def\pgf@shading@device{/DeviceCMYK}%
    \def\pgf@shading@ps@device{setcmykcolor}%
    \def\pgf@shading@model{cmyk}%
      \pgfshadingmodelrgbfalse
      \pgfshadingmodelcmyktrue
  \fi
  \ifx\pgf@mod@test\XC@mod@gray
    \def\pgf@shading@functional@range{0 1}%
    \def\pgf@shading@device{/DeviceGray}%
    \def\pgf@shading@ps@device{setgray}%
    \def\pgf@shading@model{gray}%
      \pgfshadingmodelrgbfalse
      \pgfshadingmodelgraytrue
  \fi
  \edef\pgf@sys@driver@dvisvgm{pgfsys-dvisvgm.def}%
  \ifx\pgfsysdriver\pgf@sys@driver@dvisvgm
    \def\pgf@shading@model{rgb}%
  \fi
  \edef\pgf@sys@driver@texforht{pgfsys-tex4ht.def}%
  \ifx\pgfsysdriver\pgf@sys@driver@texforht
    \def\pgf@shading@model{rgb}%
  \fi
}
\def\pgffuncshadingrgbtocmyk{%
  1.0 exch sub 3 1 roll
  1.0 exch sub 3 1 roll
  1.0 exch sub 3 1 roll
  3 copy
  2 copy gt { exch } if pop
  2 copy gt { exch } if pop
  dup 3 1 roll sub
  0.0 2 copy lt { exch } if pop
  1.0 2 copy gt { exch } if pop
  4 1 roll
  dup 3 1 roll sub
  0.0 2 copy lt { exch } if pop
  1.0 2 copy gt { exch } if pop
  4 1 roll
  dup 3 1 roll sub
  0.0 2 copy lt { exch } if pop
  1.0 2 copy gt { exch } if pop
  4 1 roll
}
\def\pgffuncshadingrgbtogray{%
  0.11 mul exch 0.59 mul add exch 0.3 mul add
}
\def\pgffuncshadingcmyktorgb{%
  % covert to CMY
  dup 3 1 roll add
  1.0 2 copy gt { exch } if pop
  4 1 roll
  dup 3 1 roll add
  1.0 2 copy gt { exch } if pop
  4 1 roll
  add
  1.0 2 copy gt { exch } if pop
  3 1 roll
  % covert to RGB
  1.0 exch sub
  3 1 roll
  1.0 exch sub
  3 1 roll
  1.0 exch sub
  3 1 roll
}
\def\pgffuncshadingcmyktogray{%
  exch 0.11 mul add exch 0.59 mul add exch 0.3 mul add
  1.0 2 copy gt { exch } if pop
  1.0 exch sub
}
\def\pgffuncshadinggraytorgb{%
  dup dup
}
\def\pgffuncshadinggraytocmyk{%
  0.0 0.0 0.0
  4 3 roll
}
\def\pgfutilgetcmykshadingsdriver{%
  \expandafter\pgfutil@getcmykshadingsdriver\pgfsysdriver[
}
\def\pgfutil@getcmykshadingsdriver pgfsys-#1[{%
  \edef\pgfsyscmykshadingsdriver{pgfsys-cmykshadings-#1}%
}
\pgfutilgetcmykshadingsdriver
\pgfutil@InputIfFileExists{\pgfsyscmykshadingsdriver}{}{}
\newif\ifpgfcmykshadingdefault
\DeclareOption{cmyk}{%
  \pgfcmykshadingdefaulttrue
}
\DeclareOption{rgb}{%
  \pgfcmykshadingdefaultfalse
}
\ExecuteOptions{cmyk}
\ProcessOptions\relax
%% 
%%
%% End of file `pgf-cmykshadings.sty'.
