[latex3-commits] [git/LaTeX3-latex3-latex3] master: Enable color mixes with DeviceN colors (76f47e5da)
Joseph Wright
joseph.wright at morningstar2.co.uk
Sat Sep 19 09:38:36 CEST 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/76f47e5da2f207a1cd317e8e4664695c06cb7e81
>---------------------------------------------------------------
commit 76f47e5da2f207a1cd317e8e4664695c06cb7e81
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sat Sep 19 08:38:36 2020 +0100
Enable color mixes with DeviceN colors
>---------------------------------------------------------------
76f47e5da2f207a1cd317e8e4664695c06cb7e81
l3experimental/l3color/l3color.dtx | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/l3experimental/l3color/l3color.dtx b/l3experimental/l3color/l3color.dtx
index a15ad3551..34fe5a413 100644
--- a/l3experimental/l3color/l3color.dtx
+++ b/l3experimental/l3color/l3color.dtx
@@ -1865,6 +1865,7 @@
% \@@_model_devicen_parse_generic:nn
% }
% \begin{macro}[EXP]{\@@_model_devicen_parse:nw}
+% \begin{macro}[EXP]{\@@_model_devicen_mix:nw}
% \begin{macro}{\@@_model_devicen_init:nnn}
% \begin{macro}{\@@_model_devicen_init:nnnn}
% \begin{macro}{\@@_model_devicen_tranform:w}
@@ -1965,6 +1966,14 @@
{ color \int_use:N \g_@@_model_int } {####1}
}
}
+ \cs_new_protected:cpx { @@_model_ #4 _white: }
+ {
+ \prop_put:Nnn \exp_not:N \l_@@_named_white_prop {#4}
+ { \prg_replicate:nn {#1} { 0 ~ } }
+ \exp_not:N \int_compare:nNnF { \tex_currentgrouplevel:D } = 0
+ { \group_insert_after:N \exp_not:c { @@_model_ #4 _ white: } }
+ }
+ \use:c { @@_model_ #4 _white: }
\@@_model_devicen_init:nnn {#1} {#2} {#3}
}
% \end{macrocode}
@@ -1977,11 +1986,18 @@
{
\cs_new:cpn { @@_parse_model_ #1 :w } ##1 , ##2 \s_@@_stop
{ {#1} { \@@_parse_number:n {##1} } }
+ \cs_new_eq:cN { @@_parse_mix_ #1 :nw } \@@_parse_mix_gray:nw
}
\cs_new_protected:cpn { @@_model_devicen_parse_2:nn } #1#2
{
\cs_new:cpn { @@_parse_model_ #1 :w } ##1 , ##2 , ##3 \s_@@_stop
{ {#1} { \@@_parse_number:n {##1} ~ \@@_parse_number:n {##2} } }
+ \cs_new:cpn { @@_parse_mix_ #1 :nw }
+ ##1##2 ~ ##3 \s_@@_mark ##4 ~ ##5 \s_@@_stop
+ {
+ \fp_eval:n { ##2 * ##1 + ##4 * ( 1 - ##1 ) } \c_space_tl
+ \fp_eval:n { ##3 * ##1 + ##5 * ( 1 - ##1 ) }
+ }
}
\cs_new_protected:cpn { @@_model_devicen_parse_3:nn } #1#2
{
@@ -1994,6 +2010,7 @@
\@@_parse_number:n {##3}
}
}
+ \cs_new_eq:cN { @@_parse_mix_ #1 :nw } \@@_parse_mix_rgb:nw
}
\cs_new_protected:cpn { @@_model_devicen_parse_4:nn } #1#2
{
@@ -2008,6 +2025,7 @@
\@@_parse_number:n {##4}
}
}
+ \cs_new_eq:cN { @@_parse_mix_ #1 :nw } \@@_parse_mix_cmyk:nw
}
\cs_new_protected:Npn \@@_model_devicen_parse_generic:nn #1#2
{
@@ -2016,6 +2034,13 @@
{#1}
{ \@@_model_devicen_parse:nw {#2} ##2 , \q_nil , \s_@@_stop }
}
+ \cs_new:cpx { @@_parse_mix_ #1 :nw }
+ ##1 ##2 \s_@@_mark ##3 \s_@@_stop
+ {
+ \exp_not:N \@@_model_devicen_mix:nw {##1}
+ ##2 \exp_not:N \q_nil \c_space_tl \exp_not:N \s_@@_mark
+ ##3 \exp_not:N \q_nil \c_space_tl \exp_not:N \s_@@_stop
+ }
}
\cs_new:Npn \@@_model_devicen_parse:nw #1#2 , #3 \s_@@_stop
{
@@ -2031,6 +2056,15 @@
}
}
}
+\cs_new:Npn \@@_model_devicen_mix:nw #1#2 ~ #3 \s_@@_mark #4 ~ #5 \s_@@_stop
+ {
+ \fp_eval:n { #2 * #1 + #4 * ( 1 - #1 ) }
+ \quark_if_nil:oF { \tl_head:w #3 \q_stop }
+ {
+ \c_space_tl
+ \@@_model_devicen_mix:nw {#1} #3 \s_@@_mark #5 \s_@@_stop
+ }
+ }
% \end{macrocode}
% To construct the tint transformation, we have to use PostScript. The
% aim is to have the final tint for each device colorant as
@@ -2161,6 +2195,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \subsection{Diagnostics}
%
More information about the latex3-commits
mailing list.