summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3backend/l3backend-color.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-01-30 03:00:54 +0000
committerNorbert Preining <norbert@preining.info>2021-01-30 03:00:54 +0000
commit431a21790bcbf7d842f7a3d5e6e3eaef4ae823af (patch)
tree5ae95f1f34bf81d03294fc88ed5cab6eb0e25a88 /macros/latex/contrib/l3backend/l3backend-color.dtx
parentbc31a53b31d92ddf5db3e7df811734a0141f8b3f (diff)
CTAN sync 202101300300
Diffstat (limited to 'macros/latex/contrib/l3backend/l3backend-color.dtx')
-rw-r--r--macros/latex/contrib/l3backend/l3backend-color.dtx339
1 files changed, 235 insertions, 104 deletions
diff --git a/macros/latex/contrib/l3backend/l3backend-color.dtx b/macros/latex/contrib/l3backend/l3backend-color.dtx
index f3087b0904..9e19d8ac0a 100644
--- a/macros/latex/contrib/l3backend/l3backend-color.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-color.dtx
@@ -2,7 +2,7 @@
%
%% File: l3backend-color.dtx
%
-% Copyright (C) 2019-2021 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -35,7 +35,7 @@
% }
%
% \author{^^A
-% The \LaTeX3 Project\thanks
+% The \LaTeX{} Project\thanks
% {^^A
% E-mail:
% \href{mailto:latex-team@latex-project.org}
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-01-09}
+% \date{Released 2020-01-29}
%
% \maketitle
%
@@ -173,44 +173,81 @@
% state generally. The exact form depends on the engine, and for
% \texttt{dvipdfmx}/\XeTeX{} the backend version.
%
+% \subsubsection{Common code}
+%
+% \begin{macrocode}
+%<*dvipdfmx|luatex|pdftex|xetex>
+% \end{macrocode}
+%
+% \begin{variable}{\l_@@_backend_stack_int}
+% \pdfTeX{}, \LuaTeX{} and recent \texttt{(x)dvipdfmx} have multiple stacks
+% available, and to track which one is in use a variable is required.
+% \begin{macrocode}
+\int_new:N \l_@@_backend_stack_int
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+%</dvipdfmx|luatex|pdftex|xetex>
+% \end{macrocode}
+%
% \subsubsection{\texttt{dvipdfmx}/\XeTeX{}}
%
% \begin{macrocode}
%<*dvipdfmx|xetex>
% \end{macrocode}
%
-% \begin{macro}{\__kernel_color_stack_init:Nnn}
-% \begin{variable}{\g__color_stack_int}
+% \begin{macro}{\__kernel_color_backend_stack_init:Nnn}
+% \begin{variable}
+% {\g_@@_backend_stack_int, \c_@@_backend_main_stack_int}
% 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:nNnF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
+\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__color_stack_int
- \cs_new_protected:Npn \__kernel_color_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 \g__color_stack_int
- \int_const:Nn #1 { \g__color_stack_int }
- \__kernel_backend_literal:x
+ \int_gincr:N \exp_not:N \g_@@_backend_stack_int
+ \int_const:Nn #1 { \exp_not:N \g_@@_backend_stack_int }
+ \cs_if_exist:NTF \AtBeginDvi
+ { \exp_not:N \AtBeginDvi }
+ { \exp_not:N \use:n }
{
- pdfcolorstackinit ~
- \int_use:N \g__color_stack_int \c_space_tl
- \tl_if_blank:nF {#2} { #2 ~ }
- (#3)
+ \__kernel_backend_literal:x
+ {
+ 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
+ }
}
% \end{macrocode}
% \end{variable}
% \end{macro}
%
-% \begin{macro}{\__kernel_color_stack_push:nn}
-% \begin{macro}{\__kernel_color_stack_pop:n}
+% \begin{macro}{\@@_backend_stack_push:nn, \@@_backend_stack_push:nx}
+% \begin{macro}{\@@_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_stack_push:nn #1#2
+ \cs_new_protected:Npn \@@_backend_stack_push:nn #1#2
{
\__kernel_backend_literal:x
{
@@ -219,7 +256,8 @@
push ~ (#2)
}
}
- \cs_new_protected:Npn \__kernel_color_stack_pop:n #1
+ \cs_generate_variant:Nn \@@_backend_stack_push:nn { nx }
+ \cs_new_protected:Npn \@@_backend_stack_pop:n #1
{
\__kernel_backend_literal:x
{
@@ -243,9 +281,9 @@
%<*luatex|pdftex>
% \end{macrocode}
%
-% \begin{macro}{\__kernel_color_stack_init:Nnn}
+% \begin{macro}{\__kernel_color_backend_stack_init:Nnn}
% \begin{macrocode}
-\cs_new_protected:Npn \__kernel_color_stack_init:Nnn #1#2#3
+\cs_new_protected:Npn \__kernel_color_backend_stack_init:Nnn #1#2#3
{
\int_const:Nn #1
{
@@ -262,10 +300,10 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\__kernel_color_stack_push:nn}
-% \begin{macro}{\__kernel_color_stack_pop:n}
+% \begin{macro}{\@@_backend_stack_push:nn, \@@_backend_stack_push:nx}
+% \begin{macro}{\@@_backend_stack_pop:n}
% \begin{macrocode}
-\cs_new_protected:Npn \__kernel_color_stack_push:nn #1#2
+\cs_new_protected:Npn \@@_backend_stack_push:nn #1#2
{
%<*luatex>
\tex_pdfextension:D colorstack ~
@@ -275,7 +313,8 @@
%</pdftex>
\int_eval:n {#1} ~ push ~ {#2}
}
-\cs_new_protected:Npn \__kernel_color_stack_pop:n #1
+\cs_generate_variant:Nn \@@_backend_stack_push:nn { nx }
+\cs_new_protected:Npn \@@_backend_stack_pop:n #1
{
%<*luatex>
\tex_pdfextension:D colorstack ~
@@ -309,7 +348,7 @@
% \@@_backend_select:n
% }
% \begin{macro}{\@@_backend_reset:}
-% \begin{macro}{color.sc, color.fc}
+% \begin{macro}{color.sc}
% Push the data to the stack. In the case of \texttt{dvips} also saves the
% drawing color in raw PostScript.
% \begin{macrocode}
@@ -323,8 +362,7 @@
{
\__kernel_backend_literal:n { color~push~ #1 }
%<*dvips>
- \__kernel_backend_postscript:n { /color.sc~ { ~ } ~def }
- \__kernel_backend_postscript:n { /color.fc~ { ~ } ~def }
+ \__kernel_backend_postscript:n { /color.sc ~ { } ~ def }
%</dvips>
\group_insert_after:N \@@_backend_reset:
}
@@ -345,11 +383,10 @@
%<*dvipdfmx|luatex|pdftex|xetex>
% \end{macrocode}
%
-% \begin{variable}{\l__kernel_color_stack_int}
-% \pdfTeX{}, \LuaTeX{} and recent \texttt{(x)dvipdfmx} have multiple stacks
-% available, and to track which one is in use a variable is required.
+% \begin{variable}{\l_@@_backend_fill_tl, \l_@@_backend_stroke_tl}
% \begin{macrocode}
-\int_new:N \l__kernel_color_stack_int
+\tl_new:N \l_@@_backend_fill_tl
+\tl_new:N \l_@@_backend_stroke_tl
% \end{macrocode}
% \end{variable}
%
@@ -359,25 +396,29 @@
% \@@_backend_select_gray:n ,
% \@@_backend_select_rgb:n
% }
+% \begin{macro}{\@@_backend_select:nn}
% \begin{macro}{\@@_backend_reset:}
-% Simply dump the data, but allowing for \LuaTeX{}.
+% Store the values then pass to the stack.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select_cmyk:n #1
- { \@@_backend_select:n { #1 ~ k ~ #1 ~ K } }
+ { \@@_backend_select:nn { #1 ~ k } { #1 ~ K } }
\cs_new_protected:Npn \@@_backend_select_gray:n #1
- { \@@_backend_select:n { #1 ~ g ~ #1 ~ G } }
+ { \@@_backend_select:nn { #1 ~ g } { #1 ~ G } }
\cs_new_protected:Npn \@@_backend_select_rgb:n #1
- { \@@_backend_select:n { #1 ~ rg ~ #1 ~ RG } }
-\cs_new_protected:Npn \@@_backend_select:n #1
+ { \@@_backend_select:nn { #1 ~ rg } { #1 ~ RG } }
+\cs_new_protected:Npn \@@_backend_select:nn #1#2
{
- \__kernel_color_stack_push:nn \l__kernel_color_stack_int {#1}
+ \tl_set:Nn \l_@@_backend_fill_tl {#1}
+ \tl_set:Nn \l_@@_backend_stroke_tl {#2}
+ \@@_backend_stack_push:nn \l_@@_backend_stack_int { #1 ~ #2 }
\group_insert_after:N \@@_backend_reset:
}
\cs_new_protected:Npn \@@_backend_reset:
- { \__kernel_color_stack_pop:n \l__kernel_color_stack_int }
+ { \@@_backend_stack_pop:n \l_@@_backend_stack_int }
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macrocode}
%</dvipdfmx|luatex|pdftex|xetex>
@@ -733,7 +774,7 @@
% we share the same code as for \pdfTeX{}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select_separation:nn #1#2
- { \@@_backend_select:n { /#1 ~ cs ~ /#1 ~ CS ~ #2 ~ scn ~ #2 ~ SCN } }
+ { \@@_backend_select:nn { /#1 ~ cs ~ #2 ~ scn } { /#1 ~ CS ~ #2 ~ SCN } }
\cs_new_eq:NN \@@_backend_select_devicen:nn \@@_backend_select_separation:nn
% \end{macrocode}
% \end{macro}
@@ -876,6 +917,28 @@
%</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{},
@@ -892,9 +955,11 @@
% \@@_backend_fill_cmyk:n ,
% \@@_backend_fill_gray:n ,
% \@@_backend_fill_rgb:n ,
+% \@@_backend_fill:n ,
% \@@_backend_stroke_cmyk:n ,
% \@@_backend_stroke_gray:n ,
-% \@@_backend_stroke_rgb:n
+% \@@_backend_stroke_rgb:n ,
+% \@@_backend_stroke:n
% }
% Drawing (fill/stroke) color is handled in \texttt{dvipdfmx}/\XeTeX{} in the
% same way as \LuaTeX{}/\pdfTeX{}. We use the same approach as earlier, except the
@@ -903,17 +968,31 @@
% automatically.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ k } }
+ { \@@_backend_fill:n { #1 ~ k } }
\cs_new_protected:Npn \@@_backend_fill_gray:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ g } }
+ { \@@_backend_fill:n { #1 ~ g } }
\cs_new_protected:Npn \@@_backend_fill_rgb:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ rg } }
- \cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ K } }
+ { \@@_backend_fill:n { #1 ~ rg } }
+\cs_new_protected:Npn \@@_backend_fill:n #1
+ {
+ \tl_set:Nn \l_@@_backend_fill_tl {#1}
+ \@@_backend_stack_push:nn \l_@@_backend_stack_int
+ { #1 ~ \l_@@_backend_stroke_tl }
+ \group_insert_after:N \@@_backend_reset:
+ }
+\cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1
+ { \@@_backend_stroke:n { #1 ~ K } }
\cs_new_protected:Npn \@@_backend_stroke_gray:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ G } }
+ { \@@_backend_stroke:n { #1 ~ G } }
\cs_new_protected:Npn \@@_backend_stroke_rgb:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ RG } }
+ { \@@_backend_stroke:n { #1 ~ RG } }
+\cs_new_protected:Npn \@@_backend_stroke:n #1
+ {
+ \tl_set:Nn \l_@@_backend_stroke_tl {#1}
+ \@@_backend_stack_push:nn \l_@@_backend_stack_int
+ { \l_@@_backend_fill_tl \c_space_tl #1 }
+ \group_insert_after:N \@@_backend_reset:
+ }
% \end{macrocode}
% \end{macro}
%
@@ -926,9 +1005,9 @@
% }
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_fill_separation:nn #1#2
- { \__kernel_backend_literal_pdf:n { /#1 ~ cs ~ #2 ~ scn } }
+ { \@@_backend_fill:n { /#1 ~ cs ~ #2 ~ scn } }
\cs_new_protected:Npn \@@_backend_stroke_separation:nn #1#2
- { \__kernel_backend_literal_pdf:n { /#1 ~ CS ~ #2 ~ SCN } }
+ { \@@_backend_stroke:n { /#1 ~ CS ~ #2 ~ SCN } }
\cs_new_eq:NN \@@_backend_fill_devicen:nn \@@_backend_fill_separation:nn
\cs_new_eq:NN \@@_backend_stroke_devicen:nn \@@_backend_stroke_separation:nn
% \end{macrocode}
@@ -939,6 +1018,52 @@
% \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}
%
@@ -947,19 +1072,26 @@
% \@@_backend_fill_cmyk:n ,
% \@@_backend_fill_gray:n ,
% \@@_backend_fill_rgb:n ,
+% \@@_backend_fill:n ,
% \@@_backend_stroke_cmyk:n ,
% \@@_backend_stroke_gray:n ,
% \@@_backend_stroke_rgb:n
% }
-% All questions of saving the non-stacked data.
+% Fill color here is the same as general color \emph{except} we skip the
+% stroke part.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1
- { \__kernel_backend_postscript:n { /color.fc { #1 ~ setcmykcolor } def } }
+ { \@@_backend_fill:n { cmyk ~ #1 } }
\cs_new_protected:Npn \@@_backend_fill_gray:n #1
- { \__kernel_backend_postscript:n { /color.fc { #1 ~ setgray } def } }
+ { \@@_backend_fill:n { gray ~ #1 } }
\cs_new_protected:Npn \@@_backend_fill_rgb:n #1
- { \__kernel_backend_postscript:n { /color.fc { #1 ~ setrgbcolor } def } }
- \cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1
+ { \@@_backend_fill:n { rgb ~ #1 } }
+\cs_new_protected:Npn \@@_backend_fill:n #1
+ {
+ \__kernel_backend_literal:n { color~push~ #1 }
+ \group_insert_after:N \@@_backend_reset:
+ }
+\cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1
{ \__kernel_backend_postscript:n { /color.sc { #1 ~ setcmykcolor } def } }
\cs_new_protected:Npn \@@_backend_stroke_gray:n #1
{ \__kernel_backend_postscript:n { /color.sc { #1 ~ setgray } def } }
@@ -977,9 +1109,9 @@
% }
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_fill_separation:nn #1#2
- { \__kernel_backend_postscript:n { /color.fc { #1 } def } }
+ { \@@_backend_fill:n { separation ~ #1 ~ #2 } }
\cs_new_protected:Npn \@@_backend_stroke_separation:nn #1#2
- { \__kernel_backend_postscript:n { /color.sc { #1 } def } }
+ { \__kernel_backend_postscript:n { /color.sc { separation ~ #1 ~ #2 } def } }
\cs_new_eq:NN \@@_backend_fill_devicen:nn \@@_backend_fill_separation:nn
\cs_new_eq:NN \@@_backend_stroke_devicen:nn \@@_backend_stroke_separation:nn
% \end{macrocode}
@@ -996,84 +1128,84 @@
% \begin{macro}
% {
% \@@_backend_fill_cmyk:n ,
-% \@@_backend_stroke_cmyk:n
-% }
-% \begin{macro}{\@@_backend_cmyk:nw}
-% \begin{macro}
-% {
% \@@_backend_fill_gray:n ,
-% \@@_backend_stroke_gray:n
-% }
-% \begin{macro}{\@@_backend_gray:nn, \@@_backend_gray_aux:n}
-% \begin{macro}
-% {
-% \@@_backend_fill_rgb:n ,
-% \@@_backend_stroke_rgb:n
+% \@@_backend_fill_rgb:n ,
+% \@@_backend_fill:n
% }
-% \begin{macro}{\@@_backend_rgb:nw}
-% \begin{macro}{\@@_backend:nnnn}
-% For drawings in SVG, we use scopes for all colors. That
+% Fill color here is the same as general color \emph{except} we skip the
+% stroke part.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1
+ { \@@_backend_fill:n { cmyk ~ #1 } }
+\cs_new_protected:Npn \@@_backend_fill_gray:n #1
+ { \@@_backend_fill:n { gray ~ #1 } }
+\cs_new_protected:Npn \@@_backend_fill_rgb:n #1
+ { \@@_backend_fill:n { rgb ~ #1 } }
+\cs_new_protected:Npn \@@_backend_fill:n #1
+ {
+ \__kernel_backend_literal:n { color~push~ #1 }
+ \group_insert_after:N \@@_backend_reset:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_backend_stroke_cmyk:n}
+% \begin{macro}{\@@_backend_stroke_cmyk:w}
+% \begin{macro}{\@@_backend_stroke_gray:n, \@@_backend_stroke_gray_aux:n}
+% \begin{macro}{\@@_backend_stroke_rgb:n}
+% \begin{macro}{\@@_backend_stroke_rgb:w}
+% \begin{macro}{\@@_backend:nnn}
+% For drawings in SVG, we use scopes for all stroke colors. That
% requires using \texttt{RGB} values, which luckily are easy to
% convert here (|cmyk| to |RGB| is a fixed function).
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1
- { \@@_backend_cmyk:nw { fill } #1 \s_@@_stop }
\cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1
- { \@@_backend_cmyk:nw { stroke } #1 \s_@@_stop }
-\cs_new_protected:Npn \@@_backend_cmyk:nw
- #1#2 ~ #3 ~ #4 ~ #5 \s_@@_stop
+ { \@@_backend_cmyk:w #1 \s_@@_stop }
+\cs_new_protected:Npn \@@_backend_stroke_cmyk:w
+ #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
{
\use:x
{
- \@@_backend:nnnn
- {#1}
- { \fp_eval:n { -100 * ( 1 - min ( 1 , #2 + #5 ) ) } }
- { \fp_eval:n { -100 * ( 1 - min ( 1 , #3 + #5 ) ) } }
- { \fp_eval:n { -100 * ( 1 - min ( 1 , #4 + #5 ) ) } }
+ \@@_backend:nnn
+ { \fp_eval:n { -100 * ( 1 - min ( 1 , #1 + #4 ) ) } }
+ { \fp_eval:n { -100 * ( 1 - min ( 1 , #2 + #4 ) ) } }
+ { \fp_eval:n { -100 * ( 1 - min ( 1 , #3 + #4 ) ) } }
}
}
-\cs_new_protected:Npn \@@_backend_fill_gray:n #1
- { \@@_backend_grab:nn { fill } {#1} }
\cs_new_protected:Npn \@@_backend_stroke_gray:n #1
- { \@@_backend_grab:nn { stroke } {#1} }
-\cs_new_protected:Npn \@@_backend_gray:nn #1#2
{
\use:x
{
- \@@_backend_gray_aux:nn
- {#1}
- { \fp_eval:n { 100 * (#2) } }
+ \@@_backend_stroke_gray_aux:n
+ { \fp_eval:n { 100 * (#1) } }
}
}
-\cs_new_protected:Npn \@@_backend_gray_aux:nn #1#2
- { \@@_backend:nnn {#1} {#2} {#2} {#2} }
-\cs_new_protected:Npn \@@_backend_fill_rgb:n #1
- { \@@_backend_rgb:nw { fill } #1 \s_@@_stop }
+\cs_new_protected:Npn \@@_backend_stroke_gray_aux:n #1
+ { \@@_backend:nnn {#1} {#1} {#1} }
\cs_new_protected:Npn \@@_backend_stroke_rgb:n #1
- { \@@_backend_rgb:nw { stroke } #1 \s_@@_stop }
-\cs_new_protected:Npn \@@_backend_rgb:nw
- #1#2 ~ #3 ~ #4\s_@@_stop
+ { \@@_backend_rgb:w #1 \s_@@_stop }
+\cs_new_protected:Npn \@@_backend_stroke_rgb:w
+ #1 ~ #2 ~ #3 \s_@@_stop
{
\use:x
{
- \@@_backend:nnnn
- { fill }
+ \@@_backend:nnn
+ { \fp_eval:n { 100 * (#1) } }
{ \fp_eval:n { 100 * (#2) } }
{ \fp_eval:n { 100 * (#3) } }
- { \fp_eval:n { 100 * (#4) } }
}
}
-\cs_new_protected:Npx \@@_backend:nnnn #1#2#3#4
+\cs_new_protected:Npx \@@_backend:nnn #1#2#3
{
\__kernel_backend_scope:n
{
- #1 =
+ stroke =
"
rgb
(
+ #1 \c_percent_str ,
#2 \c_percent_str ,
- #3 \c_percent_str ,
- #4 \c_percent_str
+ #3 \c_percent_str
)
"
}
@@ -1085,7 +1217,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}
% {