[pdftex] Color stack, first try

Heiko Oberdiek oberdiek at uni-freiburg.de
Mon Feb 17 13:10:38 CET 2003


Hello Hans,

On Mon, Feb 17, 2003 at 02:39:39AM +0100, Hans Hagen wrote:

> Hi Heiko,
> \
> >File "pdftex.ch" implements the pdfTeX primitive
> >interface.
> >Because color was set by \pdfliteral, this command and its
> >node type are also used for the color stack methods:
> >
> >* \pdfliteral colorset{<color setting>}
> >* \pdfliteral colorpush{<color setting>}
> >* \pdfliteral colorpop
> >* \pdfliteral colorpeek
> 
> hm, this will unnecessarry overload \pdfliteral with keywords (i use lots 

It was the easiest method to implement and I want only give
an example that a color stack is possible.

> of such literals and don't want a slower pdftex), so why not use
> 
>   \pdfcolorliteral
> 
> Also, there is less change in compatibility problems (i have no plans to 
> use color literals in context) or of potential clashes.

Yes, the availability is easy to test with a new command name.

> Actually, it would be better to let pdftex handle this by means of 
> interpreting \specials (there is already such handling and it would conform 
> dvi/pdfm); esp since the content is not literal (in th esense that it is 
> parsed content).

You mean something like the following?

\special{color push Black}
\special{color pop}
\special{color push rgb 1 0 0}
\special{color push gray 1}

And pdfTeX translates the arguments to
  Black        ==> 0 g 0 G
  rgb %1 %2 %3 ==> %1 %2 %3 rg %1 %2 %3 RG
  gray %1      ==> %1 g %1 G

It is more to implement, but then the same \special commands
could be used.

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>
-- 


More information about the pdftex mailing list