[dvipdfmx] improving color stack in xdvipdfmx

Shunsaku Hirata shunsaku.hirata74 at gmail.com
Wed Jul 1 21:51:03 CEST 2020


The change for extended color support was already included.

Here is a simple example (Indexed and CalGray) for XeLaTeX
and LaTeX+dvipdfmx:

\documentclass{article}
\begin{document}
%% Indexed: [balck red green blue]
\special{pdf:obj @colorspace:indexed [/Indexed
/DeviceRGB 3 <000000 FF0000 00FF00 0000FF>]}
Indexed:
\special{pdf:bcolor @colorspace:indexed [2]}
Green
\special{pdf:ecolor}
\special{pdf:bcolor @colorspace:indexed [3]}
Blue
\special{pdf:ecolor}
\special{pdf:bcolor @colorspace:indexed [1]}
Red
\special{pdf:ecolor}
\special{pdf:bcolor @colorspace:indexed [0]}
Black
\special{pdf:ecolor}
%% CalGray
\special{pdf:obj @colorspace:calgray [ /CalGray <<
/WhitePoint [0.95505 1.00000 1.0890] /Gamma 2.222 >> ]}
\special{pdf:bcolor @colorspace:calgray [0.4]}
CalGray example.
\special{pdf:ecolor}
\end{document}

Thanks,
Shunsaku Hirata

2020年6月26日(金) 6:08 Shunsaku Hirata <shunsaku.hirata74 at gmail.com>:
>
> > If xdvipdfmx does the management then something like this
> >
> > \special{pdf:obj @pgfpattern [/Pattern/DeviceRGB]}
> >
> > \special{pdf:bcolor @pgfpattern [1.0 0.4 0]} .... \special{pdf:ecolor}
> >
> > should work and add the pattern to the ColorSpace resource, doesn't it?
>
> It should work and dvipdfmx automatically adds a ColorSpace resource
> and a Pattern resource to the current page's resource dictionary with
> automatically assigned resource names as dictionary keys.
> (The example above should be something like
>
>    \special{pdf:bcolor @pgfpattern [1.0 0.4 0 @pattern_definition]}
> .... \special{pdf:ecolor}
>
> since a Pattern resource is also required for the "set color" PDF operator.)
>
> > This would mean that pgf should adapt its backend code (and would need
> > a way to identify the xdvipdfmx version).
>
> Unless the new syntax is used, the old approach continues to work.
> Furthermore I will consider some tricks so that both approaches can coexist.
>
> Thanks,
> Shunsaku Hirata



More information about the dvipdfmx mailing list.