[latex3-commits] [git/LaTeX3-latex3-latex3] deviceNrgb: Simplify color conversion macro signature (09d7239af)

Marcel Fabian Krüger tex at 2krueger.de
Fri Oct 22 09:43:27 CEST 2021


Repository : https://github.com/latex3/latex3
On branch  : deviceNrgb
Link       : https://github.com/latex3/latex3/commit/09d7239af4f2fb4c6a1aab6686d56438d27f463e

>---------------------------------------------------------------

commit 09d7239af4f2fb4c6a1aab6686d56438d27f463e
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Fri Oct 22 09:43:27 2021 +0200

    Simplify color conversion macro signature


>---------------------------------------------------------------

09d7239af4f2fb4c6a1aab6686d56438d27f463e
 l3kernel/l3color.dtx | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/l3kernel/l3color.dtx b/l3kernel/l3color.dtx
index c90b1efa9..e9260ab3c 100644
--- a/l3kernel/l3color.dtx
+++ b/l3kernel/l3color.dtx
@@ -654,20 +654,20 @@
     \tl_set:Nx #4
       {
         \cs_if_exist:cTF { @@_convert_ #1 _ #2 :w }
-          { \use:c { @@_convert_ #1 _ #2 :w } #3 ~ 0 ~ 0 ~ 0 \s_@@_stop }
+          { \use:c { @@_convert_ #1 _ #2 :w } #3 \s_@@_stop }
           { \use:c { c_@@_fallback_ #2 _tl } }
       }
   }
 \cs_generate_variant:Nn \@@_convert:nnnN { nV , nnV }
-\cs_new:Npn \@@_convert_gray_rgb:w #1 ~ #2 \s_@@_stop
+\cs_new:Npn \@@_convert_gray_rgb:w #1 \s_@@_stop
   { #1 ~ #1 ~ #1 }
-\cs_new:Npn \@@_convert_gray_cmyk:w #1 ~ #2 \s_@@_stop
+\cs_new:Npn \@@_convert_gray_cmyk:w #1 \s_@@_stop
   { 0 ~ 0 ~ 0 ~ \fp_eval:n { 1 - #1 } }
 %    \end{macrocode}
 %   These rather odd values are based on \textsc{ntsc} television: the set are
 %   used for the |cmyk| conversion.
 %    \begin{macrocode}
-\cs_new:Npn \@@_convert_rgb_gray:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
+\cs_new:Npn \@@_convert_rgb_gray:w #1 ~ #2 ~ #3 \s_@@_stop
   { \fp_eval:n { 0.3 * #1 + 0.59 * #2 + 0.11 * #3 } }
 %    \end{macrocode}
 %   The conversion from |rgb| to |cmyk| is the most complex: a two-step
@@ -677,7 +677,7 @@
 %   Moreover, as the likelihood of anyone using a non-unitary matrix here is
 %   tiny, we simplify and treat those two concepts as no-ops.
 %    \begin{macrocode}
-\cs_new:Npn \@@_convert_rgb_cmyk:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
+\cs_new:Npn \@@_convert_rgb_cmyk:w #1 ~ #2 ~ #3 \s_@@_stop
   {
     \exp_args:Nf \@@_convert_rgb_cmyk:nnnn
       { \fp_eval:n { min ( 1 - #1 , 1 - #2 , 1 - #3 ) } } {#1} {#2} {#3}
@@ -689,9 +689,9 @@
     \fp_eval:n { min ( 1 , max ( 0 , 1 - #4 - #1 ) ) } \c_space_tl
     #1
   }
-\cs_new:Npn \@@_convert_cmyk_gray:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \s_@@_stop
+\cs_new:Npn \@@_convert_cmyk_gray:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
   { \fp_eval:n { 1 - min ( 1 , 0.3 * #1 + 0.59 * #2 + 0.11 * #3 + #4 ) } }
-\cs_new:Npn \@@_convert_cmyk_rgb:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \s_@@_stop
+\cs_new:Npn \@@_convert_cmyk_rgb:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
   {
     \fp_eval:n { 1 - min ( 1 , #1 + #4 ) } \c_space_tl
     \fp_eval:n { 1 - min ( 1 , #2 + #4 ) } \c_space_tl
@@ -1933,7 +1933,7 @@
   }
 \cs_new_protected:Npn \@@_model_separation_cmyk:nnnnnn #1#2#3#4#5#6
   {
-    \cs_new:cpn { @@_convert_ #1 _cmyk:w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpn { @@_convert_ #1 _cmyk:w } ##1 \s_@@_stop
       {
          \fp_eval:n {##1 * #3} ~
          \fp_eval:n {##1 * #4} ~
@@ -1948,7 +1948,7 @@
   }
 \cs_new_protected:Npn \@@_model_separation_rgb:nnnnnn #1#2#3#4#5#6
   {
-    \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 \s_@@_stop
       {
          \fp_eval:n {##1 * #3} ~
          \fp_eval:n {##1 * #4} ~
@@ -1962,16 +1962,16 @@
   }
 \cs_new_protected:Npn \@@_model_separation_gray:nnnnnn #1#2#3#4#5#6
   {
-    \cs_new:cpn { @@_convert_ #1 _cmyk:w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpn { @@_convert_ #1 _cmyk:w } ##1 \s_@@_stop
       {
         \fp_eval:n {##1 * #3} ~
         \fp_eval:n {##1 * #3} ~
         \fp_eval:n {##1 * #3} ~
         \fp_eval:n {##1 * #3}
       }
-    \cs_new:cpn { @@_convert_ #1 _gray:w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpn { @@_convert_ #1 _gray:w } ##1 \s_@@_stop
       { \fp_eval:n {##1 * #3} }
-    \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 \s_@@_stop
       {
         \fp_eval:n {##1 * #3} ~
         \fp_eval:n {##1 * #3} ~
@@ -1985,11 +1985,11 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_model_convert:nnn #1#2#3
   {
-    \cs_new:cpx { @@_convert_ #1 _ #3 :w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpx { @@_convert_ #1 _ #3 :w } ##1 \s_@@_stop
       {
         \exp_not:N \exp_args:NNe \exp_not:N \use:nn
         \exp_not:c { @@_convert_  #2 _ #3 :w }
-          { \exp_not:c { @@_convert_ #1 _ #2 :w } ##1 ~ ##2 \s_@@_stop }
+          { \exp_not:c { @@_convert_ #1 _ #2 :w } ##1 \s_@@_stop }
           \c_space_tl \exp_not:N \s_@@_stop
       }
   }
@@ -2021,11 +2021,11 @@
     \tl_if_exist:cTF { c_@@_model_whitepoint_CIELAB_ #1 _tl }
       {
         \@@_backend_separation_init_CIELAB:nnn {#1} {#3} { #4 ~ #5 ~ #6 }
-        \cs_new:cpn { @@_convert_ #2 _cmyk:w } ##1 ~ ##2 \s_@@_stop
+        \cs_new:cpn { @@_convert_ #2 _cmyk:w } ##1 \s_@@_stop
           { 0 ~ 0 ~ 0 ~ 1 }
-        \cs_new:cpn { @@_convert_ #2 _rgb:w } ##1 ~ ##2 \s_@@_stop
+        \cs_new:cpn { @@_convert_ #2 _rgb:w } ##1 \s_@@_stop
           { 1 ~ 1 ~ 1 }
-        \cs_new:cpn { @@_convert_ #2 _gray:w } ##1 ~ ##2 \s_@@_stop
+        \cs_new:cpn { @@_convert_ #2 _gray:w } ##1 \s_@@_stop
           { 1 }
       }
       {
@@ -2406,11 +2406,11 @@
   }
 \cs_new_protected:Npn \@@_model_devicen_convert:nnnn #1#2#3#4
   {
-    \cs_new:cpx { @@_convert_ #1 _ #2 :w } ##1 0 ~ 0 ~ 0 \s_@@_stop
+    \cs_new:cpx { @@_convert_ #1 _ #2 :w } ##1 \s_@@_stop
       {
         \exp_not:c { @@_convert_devicen_ #2 : \prg_replicate:nn {#3} { n } w }
           \prg_replicate:nn {#3} { { 1 } }
-          ##1 \exp_not:N \s_@@_mark
+          ##1 ~ \exp_not:N \s_@@_mark
           \clist_map_function:nN {#4} \@@_model_devicen_convert:n
           {}
           \exp_not:N \s_@@_stop





More information about the latex3-commits mailing list.