[latex3-commits] [git/LaTeX3-latex3-latex3] icc: Use an auxilary for color model creation (98ced0c92)
Joseph Wright
joseph.wright at morningstar2.co.uk
Sun Feb 21 12:09:29 CET 2021
Repository : https://github.com/latex3/latex3
On branch : icc
Link : https://github.com/latex3/latex3/commit/98ced0c92dfccf4daae8318c9be20c0fd9b8f4c9
>---------------------------------------------------------------
commit 98ced0c92dfccf4daae8318c9be20c0fd9b8f4c9
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sun Feb 21 11:09:11 2021 +0000
Use an auxilary for color model creation
>---------------------------------------------------------------
98ced0c92dfccf4daae8318c9be20c0fd9b8f4c9
l3kernel/l3color.dtx | 67 ++++++++++++++++++++++++----------------------------
1 file changed, 31 insertions(+), 36 deletions(-)
diff --git a/l3kernel/l3color.dtx b/l3kernel/l3color.dtx
index b3fd3cfa7..d079d3a7d 100644
--- a/l3kernel/l3color.dtx
+++ b/l3kernel/l3color.dtx
@@ -1750,6 +1750,35 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@@_model_init:nn}
+% A shared auxiliary to do the basics of setting up a new model: reserve a
+% number, create a fallback and white-eqivalent, set up links to the backend.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_model_init:nnn #1#2#3
+ {
+ \int_gincr:N \g_@@_model_int
+ \tl_const:cx { c_@@_fallback_ #1 _tl }
+ { 1 \prg_replicate:nn { #2 - 1 } { ~ 1 } }
+ \clist_map_inline:nn { fill , stroke , select }
+ {
+ \cs_new_protected:cpx { @@_backend_ ##1 _ #1 :n } ####1
+ {
+ \exp_not:c { @@_backend_ ##1 _ #3 :nn }
+ { color \int_use:N \g_@@_model_int } {####1}
+ }
+ }
+ \cs_new_protected:cpx { @@_model_ #1 _white: }
+ {
+ \prop_put:Nnn \exp_not:N \l_@@_named_white_prop {#1}
+ { 0 \prg_replicate:nn { #2 - 1 } { ~ 0 } }
+ \exp_not:N \int_compare:nNnF { \tex_currentgrouplevel:D } = 0
+ { \group_insert_after:N \exp_not:c { @@_model_ #1 _ white: } }
+ }
+ \use:c { @@_model_ #1 _white: }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\@@_model_separation:n}
% \begin{macro}{\@@_model_separation:nn}
% \begin{macro}{\@@_model_separation:nnn}
@@ -1829,31 +1858,15 @@
\cs_new_protected:Npn \@@_model_separation:w
#1 , #2 , #3 , #4 , #5 \s_@@_stop #6#7#8
{
- \int_gincr:N \g_@@_model_int
- \tl_const:cn { c_@@_fallback_ #6 _tl } { 1 }
+ \@@_model_init:nnn {#6} { 1 } { separation }
\cs_new_eq:cN { @@_parse_mix_ #6 :nw } \@@_parse_mix_gray:nw
\cs_new:cpn { @@_parse_model_ #6 :w } ##1 , ##2 \s_@@_stop
{ {#6} { \@@_parse_number:n {##1} } }
- \clist_map_inline:nn { fill , stroke , select }
- {
- \cs_new_protected:cpx { @@_backend_ ##1 _ #6 :n } ####1
- {
- \exp_not:c { @@_backend_ ##1 _ separation:nn }
- { color \int_use:N \g_@@_model_int } {####1}
- }
- }
\use:c { @@_model_separation_ #8 :nnnnnn }
{#6} {#7} {#1} {#2} {#3} {#4}
\prop_gput:Nnn \g_@@_alternative_model_prop {#6} {#8}
\prop_gput:Nnx \g_@@_colorants_prop {#6}
{ \str_convert_pdfname:n {#7} }
- \cs_new_protected:cpx { @@_model_ #6 _white: }
- {
- \prop_put:Nnn \exp_not:N \l_@@_named_white_prop {#6} { 0 }
- \exp_not:N \int_compare:nNnF { \tex_currentgrouplevel:D } = 0
- { \group_insert_after:N \exp_not:c { @@_model_ #6 _ white: } }
- }
- \use:c { @@_model_ #6 _white: }
}
\cs_new_protected:Npn \@@_model_separation_cmyk:nnnnnn #1#2#3#4#5#6
{
@@ -2086,28 +2099,10 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_model_devicen:nnnn #1#2#3#4
{
- \int_gincr:N \g_@@_model_int
- \tl_const:cx { c_@@_fallback_ #4 _tl }
- { \prg_replicate:nn {#1} { 1 ~ } }
+ \@@_model_init:nnn {#4} {#1} { devicen }
\cs_if_exist_use:cF { @@_model_devicen_parse_ #1 :nn }
{ \@@_model_devicen_parse_generic:nn }
{#4} {#1}
- \clist_map_inline:nn { fill , stroke , select }
- {
- \cs_new_protected:cpx { @@_backend_ ##1 _ #4 :n } ####1
- {
- \exp_not:c { @@_backend_ ##1 _ devicen:nn }
- { 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}
\@@_model_devicen_convert:nnn {#4} {#2} {#3}
}
More information about the latex3-commits
mailing list.