[latex3-commits] [git/LaTeX3-latex3-latex3] color-models: Set up to initial Device-based Separation colorspaces (bf6f4c390)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Jul 10 17:01:00 CEST 2020


Repository : https://github.com/latex3/latex3
On branch  : color-models
Link       : https://github.com/latex3/latex3/commit/bf6f4c3909876af33a012c8293cf82e6d07a56e5

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

commit bf6f4c3909876af33a012c8293cf82e6d07a56e5
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Jul 10 16:01:00 2020 +0100

    Set up to initial Device-based Separation colorspaces


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

bf6f4c3909876af33a012c8293cf82e6d07a56e5
 l3experimental/l3color/l3color.dtx | 75 ++++++++++++++++++++++++++------------
 1 file changed, 52 insertions(+), 23 deletions(-)

diff --git a/l3experimental/l3color/l3color.dtx b/l3experimental/l3color/l3color.dtx
index 20a4521b9..6e68fa734 100644
--- a/l3experimental/l3color/l3color.dtx
+++ b/l3experimental/l3color/l3color.dtx
@@ -1371,11 +1371,12 @@
 % \begin{macro}{\@@_model_separation:nnnw}
 % \begin{macro}
 %   {
-%     \@@_model_separation_cmyk:nnnnn ,
-%     \@@_model_separation_gray:nnnnn ,
-%     \@@_model_separation_rgb:nnnnn
+%     \@@_model_separation_cmyk:nnnnnn ,
+%     \@@_model_separation_gray:nnnnnn ,
+%     \@@_model_separation_rgb:nnnnnn
 %   }
-%  \begin{macro}{\@@_model_convert:nnn}
+% \begin{macro}{\@@_model_conver:nnn}
+% \begin{macro}{\@@_model_separation_init:nnnn}
 %   Set up a new model: in general this has to be handled by a family-dependent
 %   function. To avoid some \enquote{interesting} questions with casing, we
 %   fold the case of the family name. The key--value list should always be
@@ -1472,7 +1473,7 @@
 \cs_new_protected:Npn \@@_model_separation:nnnw
   #1#2#3 #4 , #5 , #6 , #7 , #8 \s_@@_stop
   {
-    \cs_if_exist:cTF { @@_model_separation_ #3 :nnnnn }
+    \cs_if_exist:cTF { @@_model_separation_ #3 :nnnnnn }
       {
         \int_gincr:N \g_@@_separation_int
         \tl_const:cn { c_@@_fallback_ #1 _tl } { 1 }
@@ -1484,8 +1485,8 @@
             \@@_backend_family_separation:nn
               { l3color \int_use:N \g_@@_separation_int } {##1}
           }
-        \use:c { @@_model_separation_ #3 :nnnnn }
-          {#1} {#4} {#5} {#6} {#7}
+        \use:c { @@_model_separation_ #3 :nnnnnn }
+          {#1} {#2} {#4} {#5} {#6} {#7}
         \cs_new_protected:cpx { @@_model_ #1 _ white: }
           {
             \prop_put:Nnn \exp_not:N \l_@@_named_white_prop {#1} { 0 }
@@ -1499,47 +1500,51 @@
           { separation-requires-alternative } {#1}
       }
   }
-
-\cs_new_protected:Npn \@@_model_separation_cmyk:nnnnn #1#2#3#4#5
+\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
       {
-         \fp_eval:n {##1 * #2} ~
          \fp_eval:n {##1 * #3} ~
          \fp_eval:n {##1 * #4} ~
-         \fp_eval:n {##1 * #5}
+         \fp_eval:n {##1 * #5} ~
+         \fp_eval:n {##1 * #6}
       }
     \@@_model_convert:nnn {#1} { cmyk } { rgb }
     \@@_model_convert:nnn {#1} { cmyk } { gray }
+    \@@_model_separation_init:nnnn {#2} { /DeviceCMYK }
+      { 0 ~ 0 ~ 0 ~ 0 } { #3 ~ #4 ~ #5 ~ #6 }
   }
-\cs_new_protected:Npn \@@_model_separation_rgb:nnnnn #1#2#3#4#5
+\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
       {
-         \fp_eval:n {##1 * #2} ~
          \fp_eval:n {##1 * #3} ~
-         \fp_eval:n {##1 * #4}
+         \fp_eval:n {##1 * #4} ~
+         \fp_eval:n {##1 * #5}
       }
     \@@_model_convert:nnn {#1} { rgb } { cmyk }
     \@@_model_convert:nnn {#1} { rgb } { gray }
+    \@@_model_separation_init:nnnn {#2} { /DeviceRGB }
+      { 0 ~ 0 ~ 0 } { #3 ~ #4 ~ #5 }
   }
-\cs_new_protected:Npn \@@_model_separation_gray:nnnnn #1#2#3#4#5
+\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
       {
-        \fp_eval:n {##1 * #2} ~
-        \fp_eval:n {##1 * #2} ~
-        \fp_eval:n {##1 * #2} ~
-        \fp_eval:n {##1 * #2}
+        \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
-      { \fp_eval:n {##1 * #2} }
+      { \fp_eval:n {##1 * #3} }
     \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 ~ ##2 \s_@@_stop
       {
-        \fp_eval:n {##1 * #2} ~
-        \fp_eval:n {##1 * #2} ~
-        \fp_eval:n {##1 * #2}
+        \fp_eval:n {##1 * #3} ~
+        \fp_eval:n {##1 * #3} ~
+        \fp_eval:n {##1 * #3}
       }
+    \@@_model_separation_init:nnnn {#2} { /DeviceGray } { 0 } {#3}
   }
 %    \end{macrocode}
 %   Generic model conversion \emph{via} an alternative intermediate.
@@ -1555,6 +1560,30 @@
       }
   }
 %    \end{macrocode}
+%   Initialising the PDF structures needs two parts: creating an object
+%   containing the \enquote{real} name of the Separation, then adding a reference
+%   to that to each page. The latter uses the internal name of the \texttt{cs}.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_model_separation_init:nnnn #1#2#3#4
+  {
+    \pdf_object_now:nx { array }
+      {
+        /Separation
+        / \str_convert_pdfname:n {#1} ~ #2 ~
+        << /FunctionType ~ 2 /Domain ~ [0 ~ 1] /C0 ~ [#3] ~ /C1 ~ [#4] /N ~ 1 >>
+      }
+    \use:x
+      {
+        \pdfdict_gput:nnn
+          { Page / Resources / ColorSpace }
+          { l3color \int_use:N \g_@@_separation_int }
+          { \pdf_object_last: }
+      }
+  }
+\cs_if_exist:NF \pdf_object_now:nn
+  { \cs_gset_protected:Npn \@@_model_separation_init:nnnn #1#2#3#4 { } }
+%    \end{macrocode}
+% \end{macro}
 % \end{macro}
 % \end{macro}
 % \end{macro}





More information about the latex3-commits mailing list.