summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/colorspace
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-09-13 21:51:46 +0000
committerKarl Berry <karl@freefriends.org>2016-09-13 21:51:46 +0000
commit451d03eed1f677a1c576f8b701e4068b42fd9039 (patch)
tree68ed5b0e1ae8a31aea634b31cb32479e2a2a3739 /Master/texmf-dist/tex/latex/colorspace
parenta8951d1db45ca51c96ffa2c431777eb37c8a2f94 (diff)
colorspace (13sep16)
git-svn-id: svn://tug.org/texlive/trunk@42053 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/colorspace')
-rw-r--r--Master/texmf-dist/tex/latex/colorspace/colorspace.sty85
1 files changed, 53 insertions, 32 deletions
diff --git a/Master/texmf-dist/tex/latex/colorspace/colorspace.sty b/Master/texmf-dist/tex/latex/colorspace/colorspace.sty
index 97d7b64c5be..39e2bf5fb3b 100644
--- a/Master/texmf-dist/tex/latex/colorspace/colorspace.sty
+++ b/Master/texmf-dist/tex/latex/colorspace/colorspace.sty
@@ -2,9 +2,9 @@
% | Typeset colorspace.tex to get the documentation. |
% +--------------------------------------------------+
%
-%% Copyright (C) 2015 Javier Bezos
+%% Copyright (C) 2015-2016 Javier Bezos
%% All Rights Reserved
-%% http://www.tex-tipografia.com
+%% http://www.texnia.com
%%
%% This work may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3 of this
@@ -21,7 +21,8 @@
%% This work consists of the files colorspace.tex and colorspace.sty.
\ProvidesPackage{colorspace}
- [2015/06/01 v1.1.0 PDF color spaces (spot colors...) for pdfTeX]
+ [2016/09/12 v1.1.1 PDF color spaces (spot colors...) for
+ pdftex and luatex]
\edef\spc@savedcatcodes{%
\catcode`\noexpand\/=\the\catcode`\/
@@ -33,6 +34,24 @@
\catcode`\<=12
\catcode`\&=11 % we use it in macro names
+% pdftex vs luatex compatibility
+
+\ifx\pdfextension\@undefined
+ \let\spc@Pageresources\pdfpageresources
+ \let\spc@Obj\pdfobj
+ \let\spc@Lastobj\pdflastobj
+ \let\spc@Colorstack\pdfcolorstack
+ \let\spc@Colorstackinit\pdfcolorstackinit
+\else
+ \edef\spc@Pageresources{\pdfvariable pageresources}
+ \protected\def\spc@Obj{\pdfextension obj }
+ \protected\def\spc@Lastobj{\numexpr\pdffeedback lastobj\relax}
+ \protected\def\spc@Colorstack{\pdfextension colorstack}
+ \def\spc@Colorstackinit{\pdffeedback colorstackinit}
+\fi
+
+%
+
\def\spc@unknown#1#2{%
\@ifundefined{#1}%
{\PackageError{colorspace}{Unknown #2}%
@@ -128,11 +147,11 @@
\spc@csall
\definecolor{#1}{cmyk:#3}{#4}% internally always cmyk
\expandafter\spc@cmyktospot{#1}\spc@tempb % Convert from cmyk to spot
- \immediate\pdfobj{[ /Separation /\spc@tempb\space
+ \immediate\spc@Obj{[ /Separation /\spc@tempb\space
/DeviceCMYK << /FunctionType 2 /Domain [0 1]
/C0 [0 0 0 0] /C1 [\spc@tempa] /N 1 >> ]}% pdf separation
\expandafter\xdef\csname spc@ir@#1\endcsname{%
- /&\spc@tempb\space\the\pdflastobj\space 0 R}% save ref to obj
+ /&\spc@tempb\space\the\spc@Lastobj\space 0 R}% save ref to obj
\let\spc@elt\relax
\xdef\spc@csall{\spc@csall\spc@elt2{#1}}}
@@ -161,7 +180,7 @@
\def\spc@pagecs#1{%
\ifx\spc@currcs\@empty\else
\edef\tempa{%
- \noexpand\spc@remcs\the\pdfpageresources
+ \noexpand\spc@remcs\the\spc@Pageresources
\noexpand\spc@remcs{\spc@currcs}}%
\tempa
\fi
@@ -184,13 +203,13 @@
\fi}%
\spc@csall % Uses \spc@elt
\@ifundefined{spc@cs@\spc@tempc}%
- {\immediate\pdfobj{<< \spc@tempb>>}%
- \expandafter\xdef\csname spc@cs@\spc@tempc\endcsname{\the\pdflastobj}}%
+ {\immediate\spc@Obj{<< \spc@tempb>>}%
+ \expandafter\xdef\csname spc@cs@\spc@tempc\endcsname{\the\spc@Lastobj}}%
{}%
\expandafter\let\expandafter\spc@currcs\csname spc@cs@\spc@tempc\endcsname
\ifx\spc@currcs\@empty\else
- \edef\spc@tempa{\pdfpageresources{%
- \the\pdfpageresources\space/ColorSpace \@nameuse{spc@cs@\spc@tempc} 0 R}}%
+ \edef\spc@tempa{\spc@Pageresources{%
+ \the\spc@Pageresources\space/ColorSpace \@nameuse{spc@cs@\spc@tempc} 0 R}}%
\spc@tempa
\fi}
@@ -201,7 +220,7 @@
\def\spc@remcs#1\spc@remcs#2{%
\def\spc@tempc##1 /ColorSpace #2 ##2 R##3\spc@tempc{%
- \pdfpageresources{##1##3}}%
+ \spc@Pageresources{##1##3}}%
\spc@tempc#1\spc@tempc}
% Support for pgf (I hope--)
@@ -321,6 +340,8 @@
{\spc@dflttrue\spc@defcs}%
{\spc@dfltfalse\spc@defcs}}
+\@onlypreamble\definecolorspace
+
\def\spc@defcs#1#2#3{%
\@ifundefined{spc@defcs@#2}%
{\spc@unknown{spc@defcs@#2}{color space type `#2'}}%
@@ -389,7 +410,7 @@
\csname spc@ascmyk@\spc@tempa\endcsname\@@
\advance\@tempcntb-4\relax
\fi}%
- \immediate\pdfobj stream attr
+ \immediate\spc@Obj stream attr
{/FunctionType 4
/Domain [ \spc@pdfdoms]
/Range [ 0 1 0 1 0 1 0 1 ]}%
@@ -400,11 +421,11 @@
\spc@@Pblack\spc@@black neg 1.0 add\spc@nl
\the\numexpr4+\@tempcntb\relax\space 4 roll\spc@@pops
\space\string}}%
- \immediate\pdfobj{[ /DeviceN [\spc@pdfdevn\space] /DeviceCMYK
- \the\pdflastobj\space0 R
+ \immediate\spc@Obj{[ /DeviceN [\spc@pdfdevn\space] /DeviceCMYK
+ \the\spc@Lastobj\space0 R
<< /Colorants <<\spc@pdfclrnts\space >> >> ]}%
\expandafter\xdef\csname spc@ir@#1\endcsname{%
- /\spc@name\space\the\pdflastobj\space 0 R}% save ref to obj
+ /\spc@name\space\the\spc@Lastobj\space 0 R}% save ref to obj
\let\spc@elt\relax
\xdef\spc@csall{\spc@csall\spc@elt2{#1}}%
\xdef\spc@tempa{%
@@ -414,7 +435,7 @@
\endgroup
\spc@tempa}
-% === ICC based dafault spaces ===
+% === ICC based default spaces ===
% luatex removed pdffiledump, so we use lua code.
@@ -447,13 +468,13 @@
{\PackageError{colorspace}{Unsupported ICC space}%
{Currently, only Gray, RGB and CMYK are supported}}%
{\edef\spc@tempa{\@nameuse{spc@@\spc@tempa}}}%
- \immediate\pdfobj
+ \immediate\spc@Obj
stream attr {\ifcase\spc@tempa
/N 1 /Alternate /DeviceGray\or
/N 3 /Alternate /DeviceRGB\or
/N 4 /Alternate /DeviceCMYK\fi}%
file {#2}%
- \immediate\pdfobj{[ /ICCBased \the\pdflastobj\space 0 R ]}%
+ \immediate\spc@Obj{[ /ICCBased \the\spc@Lastobj\space 0 R ]}%
% to the default color list, add an intermediate name *<model>
% (only once) containing the last setting (add also the
% actual name with flag 1 instead of 2)
@@ -462,10 +483,10 @@
{\xdef\spc@csall{\spc@csall\spc@elt2{*\spc@@spacelc}}}%
{} % -- do nothing
\expandafter\xdef\csname spc@ir@*\spc@@spacelc\endcsname{%
- /Default\spc@@space\space\the\pdflastobj\space 0 R}%
+ /Default\spc@@space\space\the\spc@Lastobj\space 0 R}%
\xdef\spc@csall{\spc@csall\spc@elt1{#1}}%
\expandafter\xdef\csname spc@ir@#1\endcsname{%
- /Default\spc@@space\space\the\pdflastobj\space 0 R}%
+ /Default\spc@@space\space\the\spc@Lastobj\space 0 R}%
\endgroup}
@@ -495,21 +516,21 @@
\newcommand\textoverprint[2][\spc@opm]{{\overprintstate{#1}#2}}
-\immediate\pdfobj{<< /Type /ExtGState /op false /OP false >>}%
-\edef\spc@tempa{/SPCko \the\pdflastobj\space 0 R }%
-\immediate\pdfobj{<< /Type /ExtGState /op true /OP true /OPM 0 >>}%
-\edef\spc@tempa{\spc@tempa/SPCmz \the\pdflastobj\space 0 R }%
-\immediate\pdfobj{<< /Type /ExtGState /op true /OP true /OPM 1 >>}%
-\edef\spc@tempa{\spc@tempa/SPCop \the\pdflastobj\space 0 R }%
-\immediate\pdfobj{<< \spc@tempa>>}%
-\edef\spc@tempa{\global\pdfpageresources{\the\pdfpageresources
- \space /ExtGState \the\pdflastobj\space 0 R }}
+\immediate\spc@Obj{<< /Type /ExtGState /op false /OP false >>}%
+\edef\spc@tempa{/SPCko \the\spc@Lastobj\space 0 R }%
+\immediate\spc@Obj{<< /Type /ExtGState /op true /OP true /OPM 0 >>}%
+\edef\spc@tempa{\spc@tempa/SPCmz \the\spc@Lastobj\space 0 R }%
+\immediate\spc@Obj{<< /Type /ExtGState /op true /OP true /OPM 1 >>}%
+\edef\spc@tempa{\spc@tempa/SPCop \the\spc@Lastobj\space 0 R }%
+\immediate\spc@Obj{<< \spc@tempa>>}%
+\edef\spc@tempa{\global\spc@Pageresources{\the\spc@Pageresources
+ \space /ExtGState \the\spc@Lastobj\space 0 R }}
\spc@tempa
\def\spc@setop{%
- \pdfcolorstack\spc@opstack push{\spc@getop}%
+ \spc@Colorstack\spc@opstack push{\spc@getop}%
\aftergroup\spc@resetop}
-\def\spc@resetop{\pdfcolorstack\spc@opstack pop\relax}
+\def\spc@resetop{\spc@Colorstack\spc@opstack pop\relax}
\def\spc@getop{%
\ifcase\spc@op
/SPCmz gs
@@ -519,7 +540,7 @@
/SPCko gs
\fi}
-\chardef\spc@opstack\pdfcolorstackinit page direct{\spc@getop}
+\chardef\spc@opstack\spc@Colorstackinit page direct{\spc@getop}
\spc@savedcatcodes