summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3backend/l3backend-color.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3backend/l3backend-color.dtx')
-rw-r--r--macros/latex/contrib/l3backend/l3backend-color.dtx205
1 files changed, 54 insertions, 151 deletions
diff --git a/macros/latex/contrib/l3backend/l3backend-color.dtx b/macros/latex/contrib/l3backend/l3backend-color.dtx
index 064c55fa60..815b41302a 100644
--- a/macros/latex/contrib/l3backend/l3backend-color.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-color.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-02-07}
+% \date{Released 2022-04-10}
%
% \maketitle
%
@@ -203,54 +203,50 @@
% In \texttt{(x)dvipdfmx}, the base color stack is not set up, so we have to
% force that, as well as providing a mechanism more generally.
% \begin{macrocode}
-\int_compare:nNnTF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
- { \cs_new_protected:Npn \__kernel_color_backend_stack_init:Nnn #1#2#3 { } }
+\int_new:N \g_@@_backend_stack_int
+\cs_new_protected:Npx \__kernel_color_backend_stack_init:Nnn #1#2#3
{
- \int_new:N \g_@@_backend_stack_int
- \cs_new_protected:Npx \__kernel_color_backend_stack_init:Nnn #1#2#3
+ \int_gincr:N \exp_not:N \g_@@_backend_stack_int
+ \int_const:Nn #1 { \exp_not:N \g_@@_backend_stack_int }
+ \use:x
{
- \int_gincr:N \exp_not:N \g_@@_backend_stack_int
- \int_const:Nn #1 { \exp_not:N \g_@@_backend_stack_int }
- \use:x
+ \__kernel_backend_first_shipout:n
{
- \__kernel_backend_first_shipout:n
+ \__kernel_backend_literal:n
{
- \__kernel_backend_literal:n
- {
- pdfcolorstackinit ~
- \exp_not:N \int_use:N \exp_not:N \g_@@_backend_stack_int
- \c_space_tl
- \exp_not:N \tl_if_blank:nF {#2} { #2 ~ }
- (#3)
- }
+ pdfcolorstackinit ~
+ \exp_not:N \int_use:N \exp_not:N \g_@@_backend_stack_int
+ \c_space_tl
+ \exp_not:N \tl_if_blank:nF {#2} { #2 ~ }
+ (#3)
}
- }
- }
- \cs_if_exist:cTF { main@pdfcolorstack }
- {
- \int_set:Nn \l_@@_backend_stack_int
- { \int_use:c { main@pdfcolorstack } }
- }
- {
- \__kernel_color_backend_stack_init:Nnn \c_@@_backend_main_stack_int
- { page ~ direct } { 0 ~ g ~ 0 ~ G }
- \int_set_eq:NN \l_@@_backend_stack_int
- \c_@@_backend_main_stack_int
- \int_const:cn { main@pdfcolorstack } { \c_@@_backend_main_stack_int }
+ }
}
+ }
+\cs_if_exist:cTF { main@pdfcolorstack }
+ {
+ \int_set:Nn \l_@@_backend_stack_int
+ { \int_use:c { main@pdfcolorstack } }
+ }
+ {
+ \__kernel_color_backend_stack_init:Nnn \c_@@_backend_main_stack_int
+ { page ~ direct } { 0 ~ g ~ 0 ~ G }
+ \int_set_eq:NN \l_@@_backend_stack_int
+ \c_@@_backend_main_stack_int
+ \int_const:cn { main@pdfcolorstack } { \c_@@_backend_main_stack_int }
+ }
% \end{macrocode}
% The backend automatically restores the stack color from the \enquote{classical}
% approach (\texttt{pdf:bcolor}) after a scope. That will be an issue for us, so
% we manually ensure that the one we are using is inserted.
% \begin{macrocode}
- \cs_gset_protected:Npn \__kernel_backend_scope_end:
+\cs_gset_protected:Npn \__kernel_backend_scope_end:
+ {
+ \__kernel_backend_literal:n { x:grestore }
+ \__kernel_backend_literal:x
{
- \__kernel_backend_literal:n { x:grestore }
- \__kernel_backend_literal:x
- {
- pdfcolorstack ~
- \int_use:N \g_@@_backend_stack_int \c_space_tl current
- }
+ pdfcolorstack ~
+ \int_use:N \g_@@_backend_stack_int \c_space_tl current
}
}
% \end{macrocode}
@@ -261,26 +257,23 @@
% \begin{macro}{\__kernel_color_backend_stack_pop:n}
% Simple enough but needs a version check.
% \begin{macrocode}
-\int_compare:nNnF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
+\cs_new_protected:Npn \__kernel_color_backend_stack_push:nn #1#2
{
- \cs_new_protected:Npn \__kernel_color_backend_stack_push:nn #1#2
+ \__kernel_backend_literal:x
{
- \__kernel_backend_literal:x
- {
- pdfcolorstack ~
- \int_eval:n {#1} ~
- push ~ (#2)
- }
+ pdfcolorstack ~
+ \int_eval:n {#1} ~
+ push ~ (#2)
}
- \cs_generate_variant:Nn \__kernel_color_backend_stack_push:nn { nx }
- \cs_new_protected:Npn \__kernel_color_backend_stack_pop:n #1
+ }
+\cs_generate_variant:Nn \__kernel_color_backend_stack_push:nn { nx }
+\cs_new_protected:Npn \__kernel_color_backend_stack_pop:n #1
+ {
+ \__kernel_backend_literal:x
{
- \__kernel_backend_literal:x
- {
- pdfcolorstack ~
- \int_eval:n {#1} ~
- pop
- }
+ pdfcolorstack ~
+ \int_eval:n {#1} ~
+ pop
}
}
% \end{macrocode}
@@ -440,10 +433,6 @@
%
% \subsubsection{\texttt{dvipmdfx}/\XeTeX{}}
%
-% \begin{macrocode}
-%<*dvipdfmx|xetex>
-% \end{macrocode}
-%
% These backends have the most possible approaches: it recognises both
% \texttt{dvips}-based color specials and it's own format, plus one can
% include PDF statements directly. Recent releases also have a color stack
@@ -452,32 +441,6 @@
% we have. Thus it is used in preference to the \texttt{dvips}-style interface
% or the \enquote{native} color specials (which have only one stack).
%
-% \begin{macro}
-% {
-% \@@_backend_select_cmyk:n ,
-% \@@_backend_select_gray:n ,
-% \@@_backend_select_rgb:n
-% }
-% \begin{macro}{\@@_backend_reset:}
-% Push the data to the stack.
-% \begin{macrocode}
-\int_compare:nNnT \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
- {
- \cs_gset_protected:Npn \@@_backend_select_cmyk:n #1
- { \__kernel_backend_literal:n { pdf: bc ~ [#1] } }
- \cs_gset_eq:NN \@@_backend_select_gray:n \@@_backend_select_cmyk:n
- \cs_gset_eq:NN \@@_backend_select_rgb:n \@@_backend_select_cmyk:n
- \cs_gset_protected:Npn \@@_backend_reset:
- { \__kernel_backend_literal:n { pdf: ec } }
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macrocode}
-%</dvipdfmx|xetex>
-% \end{macrocode}
-%
% \subsection{Separations}
%
% Here, life gets interesting and we need essentially one approach per
@@ -1097,28 +1060,6 @@
%</dvipdfmx|luatex|pdftex|xetex>
% \end{macrocode}
%
-% \begin{macrocode}
-%<*dvipdfmx|xetex>
-% \end{macrocode}
-%
-% \begin{macro}{\@@_backend_select_separation:nn, \@@_backend_select_devicen:nn}
-% For older \texttt{(x)dvipdfmx}, we \emph{could} support separations using a
-% dedicated mechanism, but it was not added that long before the color
-% stacks. So instead of having two complex paths, just disable here.
-% \begin{macrocode}
-\int_compare:nNnT \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
- {
- \cs_gset_protected:Npn \@@_backend_select_separation:nn #1#2 { }
- \cs_gset_eq:NN \@@_backend_select_devicen:nn
- \@@_backend_select_separation:nn
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-%</dvipdfmx|xetex>
-% \end{macrocode}
-%
% \subsection{Fill and stroke color}
%
% Here, \texttt{dvipdfmx}/\XeTeX{} follows \LuaTeX{} and \pdfTeX{},
@@ -1198,52 +1139,6 @@
% \end{macrocode}
%
% \begin{macrocode}
-%<*dvipdfmx|xetex>
-% \end{macrocode}
-%
-% \begin{macro}
-% {
-% \@@_backend_fill_cmyk:n ,
-% \@@_backend_fill_gray:n ,
-% \@@_backend_fill_rgb:n
-% }
-% \begin{macro}{\@@_backend_reset:}
-% \begin{macro}{\@@_backend_stroke:n}
-% \begin{macro}{\@@_backend_fill_separation:nn, \@@_backend_stroke_separation:nn}
-% Deal with older \texttt{(x)dvipdfmx}.
-% \begin{macrocode}
-\int_compare:nNnT \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
- {
- \cs_gset_protected:Npn \@@_backend_fill_cmyk:n #1
- {
- \__kernel_backend_literal:n { pdf: bc ~ [#1] }
- \group_insert_after:N \@@_backend_reset:
- }
- \cs_gset_eq:NN \@@_backend_fill_gray:n \@@_backend_fill_cmyk:n
- \cs_gset_eq:NN \@@_backend_fill_rgb:n \@@_backend_fill_cmyk:n
- \cs_gset_protected:Npn \@@_backend_reset:
- { \__kernel_backend_literal:n { pdf: ec } }
- \cs_gset_protected:Npn \@@_backend_stroke:n #1
- { \__kernel_backend_literal:n {#1} }
- \cs_gset_protected:Npn \@@_backend_fill_separation:nn #1#2 { }
- \cs_gset_eq:NN \@@_backend_fill_devicen:nn
- \@@_backend_fill_separation:nn
- \cs_gset_eq:NN \@@_backend_stroke_separation:nn
- \@@_backend_fill_separation:nn
- \cs_gset_eq:NN \@@_backend_stroke_devicen:nn
- \@@_backend_stroke_separation:nn
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macrocode}
-%</dvipdfmx|xetex>
-% \end{macrocode}
-%
-% \begin{macrocode}
%<*dvips>
% \end{macrocode}
%
@@ -1414,6 +1309,14 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@@_backend_devicen_init:nnn, \@@_backend_iccbased_init:nnn}
+% No support at present.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_devicen_init:nnn #1#2#3 { }
+\cs_new_protected:Npn \@@_backend_iccbased_init:nnn #1#2#3 { }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
%</dvisvgm>
% \end{macrocode}