[latex3-commits] [git/LaTeX3-latex3-latex3] color-models: Split alternative-space color set up (0965f4d41)
Joseph Wright
joseph.wright at morningstar2.co.uk
Thu Jul 16 13:34:47 CEST 2020
Repository : https://github.com/latex3/latex3
On branch : color-models
Link : https://github.com/latex3/latex3/commit/0965f4d4102f5832c1a95251436724f185160815
>---------------------------------------------------------------
commit 0965f4d4102f5832c1a95251436724f185160815
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Thu Jul 16 12:34:47 2020 +0100
Split alternative-space color set up
This will be vital to cover CIE-Lab.
>---------------------------------------------------------------
0965f4d4102f5832c1a95251436724f185160815
l3experimental/l3color/l3color.dtx | 319 +++++++++++++++++++++
l3experimental/l3color/testfiles/m3color003.lvt | 73 +++++
.../l3color/testfiles/m3color003.ptex.tlg | 168 +++++++++++
l3experimental/l3color/testfiles/m3color003.tlg | 168 +++++++++++
.../l3color/testfiles/m3color003.uptex.tlg | 168 +++++++++++
.../l3color/testfiles/m3color003.xetex.tlg | 168 +++++++++++
6 files changed, 1064 insertions(+)
diff --git a/l3experimental/l3color/l3color.dtx b/l3experimental/l3color/l3color.dtx
index eea16d2cc..c6e57b51b 100644
--- a/l3experimental/l3color/l3color.dtx
+++ b/l3experimental/l3color/l3color.dtx
@@ -305,6 +305,41 @@
% \section{Spot colors}
% \label{l3color:sec:spot}
%
+% Additional color models are required to support specialist workflows, for
+% example those involving separations (see
+% \url{https://helpx.adobe.com/indesign/using/spot-process-colors.html}
+% for details of the use of separations in print). Color models may be split
+% into families; in the case of the basic \texttt{cmyk}, \texttt{gray}
+% and \texttt{rgb} models, the family and the model itself are synonymous. This
+% is not generally the case: see the PDF reference for more details.
+%
+% \begin{function}{\color_model_new:nnn}
+% \begin{syntax}
+% \cs{color_model_new:nnn} \Arg{model} \Arg{family} \Arg{params}
+% \end{syntax}
+% Creates a new \meta{model} which is derived from the color model \meta{family}.
+% The latter should be one of
+% \begin{itemize}
+% \item \texttt{Separation}
+% \end{itemize}
+% (The \meta{family} may be given in mixed case as-in the PDF reference:
+% internally, case of these strings is folded.)
+% Depending on the \meta{family}, one or more \meta{params} are mandatory or
+% optional.
+% \end{function}
+%
+% For a \texttt{Separation} space, there are three \emph{compulsory} keys.
+% \begin{itemize}
+% \item \texttt{name} The name of the Separation, for example the formal
+% name of a spot color ink. Such a \meta{name} may contain spaces, etc.,
+% which are not permitted in the \meta{model}.
+% \item \texttt{alternative-model} An alternative device colorspace, one of
+% \texttt{cmyk}, \texttt{rgb} or \texttt{gray}
+% \item \texttt{alternative-values} A comma-separated list of values
+% appropriate to the \texttt{alternative-model}. This information is used by
+% the PDF application if the \texttt{Separation} is not available.
+% \end{itemize}
+%
% \end{documentation}
%
% \begin{implementation}
@@ -1279,6 +1314,242 @@
% \end{macro}
% \end{macro}
%
+% \subsection{Additional color models}
+%
+% \begin{variable}{\l_@@_internal_prop}
+% \begin{macrocode}
+\prop_new:N \l_@@_internal_prop
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\g_@@_separation_int}
+% A tracker for the total number of separations.
+% \begin{macrocode}
+\int_new:N \g_@@_separation_int
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\color_model_new:nnn, \@@_model_new:nnn}
+% \begin{macro}{\@@_model_separation:n}
+% \begin{macro}{\@@_model_separation:nn}
+% \begin{macro}{\@@_model_separation:nnn}
+% \begin{macro}{\@@_model_separation:w}
+% \begin{macro}
+% {
+% \@@_model_separation_cmyk:nnnnnn ,
+% \@@_model_separation_gray:nnnnnn ,
+% \@@_model_separation_rgb:nnnnnn
+% }
+% \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
+% present, so we convert it up-front to a |prop|, then deal with the detail
+% on a per-family basis.
+% \begin{macrocode}
+\cs_new_protected:Npn \color_model_new:nnn #1#2#3
+ {
+ \exp_args:Nee \@@_model_new:nnn
+ { \tl_to_str:n {#1} }
+ { \str_foldcase:n {#2} } {#3}
+ }
+\cs_new_protected:Npn \@@_model_new:nnn #1#2#3
+ {
+ \cs_if_exist:cTF { @@_parse_model_ #1 :w }
+ {
+ \__kernel_msg_error:nnn { color } { model-already-defined } {#1}
+ }
+ {
+ \cs_if_exist:cTF { @@_model_ #2 :n }
+ {
+ \prop_set_from_keyval:Nn \l_@@_internal_prop {#3}
+ \use:c { @@_model_ #2 :n } {#1}
+ }
+ {
+ \__kernel_msg_error:nnn { color } { unknown-model-type } {#2}
+ }
+ }
+ }
+% \end{macrocode}
+% Separations must have a \enquote{real} name, which is pretty easy to find.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_model_separation:n #1
+ {
+ \prop_get:NnNTF \l_@@_internal_prop { name }
+ \l_@@_internal_tl
+ {
+ \exp_args:NV \@@_model_separation:nn
+ \l_@@_internal_tl {#1}
+ }
+ {
+ \__kernel_msg_error:nnn { color }
+ { separation-requires-name } {#1}
+ }
+ }
+% \end{macrocode}
+% We have two keys to find at this stage: the alternative space model
+% and linked values.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_model_separation:nn #1#2
+ {
+ \prop_get:NnNTF \l_@@_internal_prop { alternative-model }
+ \l_@@_internal_tl
+ {
+ \exp_args:NV \@@_model_separation:nnn
+ \l_@@_internal_tl {#2} {#1}
+ }
+ {
+ \__kernel_msg_error:nnn { color }
+ { separation-alternative-model } {#2}
+ }
+ }
+\cs_new_protected:Npn \@@_model_separation:nnn #1#2#3
+ {
+ \cs_if_exist:cTF { @@_model_separation_ #1 :nnnnnn }
+ {
+ \prop_get:NnNTF \l_@@_internal_prop { alternative-values }
+ \l_@@_internal_tl
+ {
+ \exp_after:wN \@@_model_separation:w \l_@@_internal_tl
+ , 0 , 0 , 0 , 0 \s_@@_stop {#2} {#3} {#1}
+ }
+ {
+ \__kernel_msg_error:nnn { color }
+ { separation-alternative-values } {#2}
+ }
+ }
+ {
+ \__kernel_msg_error:nnn { color }
+ { unknown-alternative-model } {#1}
+ }
+ }
+% \end{macrocode}
+% As each alternative space leads to a different requirement for conversion,
+% and as there are only a small number of choices, we manually split the data
+% and then set up. Notice that mixing tints is really just the same
+% as mixing \texttt{gray}. The \texttt{white} color is special, as it allows
+% tints to be adjusted without an additional color space. To make sure the
+% data is set for that at all group levels, we need to work on a per-level
+% basis. Within the output, only the set-up needs the \enquote{real} name
+% of the colorspace: we use a simple tracking number for general usage
+% as this is a clear namespace without issues of escaping chars.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_model_separation:w
+ #1 , #2 , #3 , #4 , #5 \s_@@_stop #6#7#8
+ {
+ \int_gincr:N \g_@@_separation_int
+ \tl_const:cn { c_@@_fallback_ #6 _tl } { 1 }
+ \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} } }
+ \cs_new_protected:cpx { @@_backend_ #6 :n } ##1
+ {
+ \@@_backend_family_separation:nn
+ { l3color \int_use:N \g_@@_separation_int } {##1}
+ }
+ \use:c { @@_model_separation_ #8 :nnnnnn }
+ {#6} {#7} {#1} {#2} {#3} {#4}
+ \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
+ {
+ \cs_new:cpn { @@_convert_ #1 _cmyk:w } ##1 ~ ##2 \s_@@_stop
+ {
+ \fp_eval:n {##1 * #3} ~
+ \fp_eval:n {##1 * #4} ~
+ \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:nnnnnn #1#2#3#4#5#6
+ {
+ \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 ~ ##2 \s_@@_stop
+ {
+ \fp_eval:n {##1 * #3} ~
+ \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:nnnnnn #1#2#3#4#5#6
+ {
+ \cs_new:cpn { @@_convert_ #1 _cmyk:w } ##1 ~ ##2 \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
+ { \fp_eval:n {##1 * #3} }
+ \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 ~ ##2 \s_@@_stop
+ {
+ \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.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_model_convert:nnn #1#2#3
+ {
+ \cs_new:cpx { @@_convert_ #1 _ #3 :w } ##1 ~ ##2 \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 }
+ \c_space_tl \exp_not:N \s_@@_stop
+ }
+ }
+% \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
+ {
+ \pdfcoredict_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}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
% \subsection{Diagnostics}
%
% \begin{macro}{\color_show:n}
@@ -1313,12 +1584,60 @@
% \subsection{Messages}
%
% \begin{macrocode}
+\__kernel_msg_new:nnnn { color } { conversion-not-available }
+ { No~model~conversion~available~from~'#1'~to~'#2'. }
+ {
+ LaTeX~has~been~asked~to~convert~a~color~from~model~'#1'~
+ to~model'#2',~but~there~is~no~method~available~to~do~that.
+ }
+\__kernel_msg_new:nnnn { color } { model-already-defined }
+ { Color~model~'#1'~already~defined. }
+ {
+ LaTeX~was~asked~to~define~a~new~color~model~called~'#1',~but~
+ this~color~model~already~exists.
+ }
+\__kernel_msg_new:nnnn { color } { separation-alternative-model }
+ { Separation~color~space~'#1'~require~an~alternative~model. }
+ {
+ LaTeX~has~been~asked~to~create~a~separation~color~space,~
+ but~no~\\ \\
+ \iow_indent:n { alternative-model = <model> }
+ \\ \\
+ key~was~given~with~the~correct~information.
+ }
+\__kernel_msg_new:nnnn { color } { separation-alternative-values }
+ { Separation~color~space~'#1'~require~values~for~the~alternative~space. }
+ {
+ LaTeX~has~been~asked~to~create~a~separation~color~space,~
+ but~no~\\ \\
+ \iow_indent:n { alternative-values = <model> }
+ \\ \\
+ key~was~given~with~the~correct~information.
+ }
+\__kernel_msg_new:nnnn { color } { separation-requires-name }
+ { Separation~color~space~'#1'~require~a~formal~name. }
+ {
+ LaTeX~has~been~asked~to~create~a~separation~color~space,~
+ but~no~\\ \\
+ \iow_indent:n { name = <formal~name> }
+ \\ \\
+ key~was~given~with~the~correct~information.
+ }
\__kernel_msg_new:nnnn { color } { unknown-color }
{ Unknown~color~'#1'. }
{
LaTeX~has~been~asked~to~use~a~color~named~'#1',~
but~this~has~never~been~defined.
}
+\__kernel_msg_new:nnnn { color } { unknown-alternative-model }
+ { Separation~color~space~'#1'~require~an~valid~alternative~space. }
+ {
+ LaTeX~has~been~asked~to~create~a~separation~color~space,~
+ but~the~model~given~as\\ \\
+ \iow_indent:n { alternative-model = <model> }
+ \\ \\
+ is~unknown.
+ }
\__kernel_msg_new:nnnn { color } { unknown-export-format }
{ Unknown~export~format~'#1'. }
{
diff --git a/l3experimental/l3color/testfiles/m3color003.lvt b/l3experimental/l3color/testfiles/m3color003.lvt
index f0fc2867a..6977d9772 100644
--- a/l3experimental/l3color/testfiles/m3color003.lvt
+++ b/l3experimental/l3color/testfiles/m3color003.lvt
@@ -140,4 +140,77 @@
\color_show:n { mixA }
}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\TEST { Creating~new~models }
+ {
+ \OMIT
+ \cs_set_protected:Npn \test:nn #1#2
+ {
+ \exp_args:Nnnx \color_model_new:nnn { BarTone #1 } { Separation }
+ {
+ name = BarTone~555~GN ,
+ alternative-model = \str_foldcase:n {#1} ,
+ alternative-values = {#2}
+ }
+ \color_set:nnn { foo #1 } { BarTone #1 } { 0.5 }
+ \color_show:n { foo #1 }
+ }
+ \TIMO
+ \test:nn { CMYK } { 0.1 , 0.2 , 0.3 , 0.4 }
+ \test:nn { RGB } { 0.1 , 0.2 , 0.3 }
+ \test:nn { Gray } { 0.1 }
+ }
+
+\TEST { Creating~new~models:~errors }
+ {
+ \color_model_new:nnn { BarToneCMYK } { Separation } { }
+ \color_model_new:nnn { foo1 } { nope } { who-cares }
+ \color_model_new:nnn { foo2 } { separation } { }
+ \color_model_new:nnn { foo2 } { separation }
+ { name = BarTone~555~GN }
+ \color_model_new:nnn { foo3 } { separation }
+ { name = BarTone~555~GN , alternative-model }
+ \color_model_new:nnn { foo4 } { separation }
+ { name = BarTone~555~GN , alternative-model = foo }
+ }
+
+\TEST { Converting~new~models }
+ {
+ \OMIT
+ \color_set:nnn { fooCMYK } { BarToneCMYK } { 0.5 }
+ \TIMO
+ \color_export:nnN { fooCMYK } { HTML } \l_tmpa_tl
+ \tl_show:N \l_tmpa_tl
+ \color_export:nnN { fooCMYK } { space-sep-cmyk } \l_tmpa_tl
+ \tl_show:N \l_tmpa_tl
+ \color_export:nnnN { BarToneCMYK } { 0.125 } { HTML } \l_tmpa_tl
+ \tl_show:N \l_tmpa_tl
+ }
+
+\TEST { Mixing~separations }
+ {
+ \OMIT
+ \color_set:nnn { fooCMYK } { BarToneCMYK } { 1.0 }
+ \TIMO
+ \color_set:nn { foo } { fooCMYK!35 }
+ \color_show:n { foo }
+ \color_set:nn { foo } { fooCMYK!55!white }
+ \color_show:n { foo }
+ }
+
+\TEST { Mixing~separation:~failures }
+ {
+ \OMIT
+ \color_set:nnn { fooCMYK } { BarToneCMYK } { 1.0 }
+ \TIMO
+ \color_set:nn { foo } { fooCMYK!35!black }
+ \color_show:n { foo }
+ \color_set:nn { foo } { fooCMYK!35!cyan }
+ \color_show:n { foo }
+ \color_set:nn { foo } { fooCMYK!35!green }
+ \color_show:n { foo }
+ }
+
\END
diff --git a/l3experimental/l3color/testfiles/m3color003.ptex.tlg b/l3experimental/l3color/testfiles/m3color003.ptex.tlg
index da2336117..b56b4f133 100644
--- a/l3experimental/l3color/testfiles/m3color003.ptex.tlg
+++ b/l3experimental/l3color/testfiles/m3color003.ptex.tlg
@@ -186,3 +186,171 @@ The color mixA has the properties:
<recently read> }
l. ... }
============================================================
+============================================================
+TEST 7: Creating new models
+============================================================
+Defining \c__color_fallback_BarToneCMYK_tl on line ...
+Defining \__color_parse_mix_BarToneCMYK:nw on line ...
+Defining \__color_parse_model_BarToneCMYK:w on line ...
+Defining \__color_backend_BarToneCMYK:n on line ...
+Defining \__color_convert_BarToneCMYK_cmyk:w on line ...
+Defining \__color_convert_BarToneCMYK_rgb:w on line ...
+Defining \__color_convert_BarToneCMYK_gray:w on line ...
+Defining \__color_model_BarToneCMYK_white: on line ...
+Defining \l__color_named_fooCMYK_tl on line ...
+Defining \l__color_named_fooCMYK_prop on line ...
+The color fooCMYK has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.5.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_BarToneRGB_tl on line ...
+Defining \__color_parse_mix_BarToneRGB:nw on line ...
+Defining \__color_parse_model_BarToneRGB:w on line ...
+Defining \__color_backend_BarToneRGB:n on line ...
+Defining \__color_convert_BarToneRGB_rgb:w on line ...
+Defining \__color_convert_BarToneRGB_cmyk:w on line ...
+Defining \__color_convert_BarToneRGB_gray:w on line ...
+Defining \__color_model_BarToneRGB_white: on line ...
+Defining \l__color_named_fooRGB_tl on line ...
+Defining \l__color_named_fooRGB_prop on line ...
+The color fooRGB has the properties:
+> model => BarToneRGB
+> BarToneRGB => 0.5.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_BarToneGray_tl on line ...
+Defining \__color_parse_mix_BarToneGray:nw on line ...
+Defining \__color_parse_model_BarToneGray:w on line ...
+Defining \__color_backend_BarToneGray:n on line ...
+Defining \__color_convert_BarToneGray_cmyk:w on line ...
+Defining \__color_convert_BarToneGray_gray:w on line ...
+Defining \__color_convert_BarToneGray_rgb:w on line ...
+Defining \__color_model_BarToneGray_white: on line ...
+Defining \l__color_named_fooGray_tl on line ...
+Defining \l__color_named_fooGray_prop on line ...
+The color fooGray has the properties:
+> model => BarToneGray
+> BarToneGray => 0.5.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 8: Creating new models: errors
+============================================================
+! LaTeX3 Error: Color model 'BarToneCMYK' already defined.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX was asked to define a new color model called 'BarToneCMYK', but this
+color model already exists.
+! LaTeX3 Error: Unknown color model type 'nope'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to use create a new color model of type 'nope', but this
+type of model is not set up.
+! LaTeX3 Error: Separation color space 'foo2' require a formal name.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ name=<formal name>
+key was given with the correct information.
+! LaTeX3 Error: Separation color space 'foo2' require an alternative model.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ alternative-model=<model>
+key was given with the correct information.
+! LaTeX3 Error: Missing/extra '=' in 'alternative-model' (in '..._keyval:Nn')
+Type <return> to continue.
+ ...
+l. ... }
+LaTeX does not know anything more about this error, sorry.
+Try typing <return> to proceed.
+If that doesn't work, type X <return> to quit.
+! LaTeX3 Error: Separation color space 'foo3' require an alternative model.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ alternative-model=<model>
+key was given with the correct information.
+! LaTeX3 Error: Separation color space 'foo' require an valid alternative
+(LaTeX3) space.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but the model given
+as
+ alternative-model=<model>
+is unknown.
+============================================================
+============================================================
+TEST 9: Converting new models
+============================================================
+> \l_tmpa_tl=BFB2A6.
+<recently read> }
+l. ... }
+> \l_tmpa_tl=0.05 0.1 0.15 0.2.
+<recently read> }
+l. ... }
+> \l_tmpa_tl=EFECE9.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 10: Mixing separations
+============================================================
+Defining \l__color_named_foo_tl on line ...
+Defining \l__color_named_foo_prop on line ...
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.35.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.55.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 11: Mixing separation: failures
+============================================================
+! LaTeX3 Error: No model conversion available from 'gray' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'gray' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+! LaTeX3 Error: No model conversion available from 'cmyk' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'cmyk' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+! LaTeX3 Error: No model conversion available from 'rgb' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'rgb' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+============================================================
diff --git a/l3experimental/l3color/testfiles/m3color003.tlg b/l3experimental/l3color/testfiles/m3color003.tlg
index cd6f777f9..d4ee5e700 100644
--- a/l3experimental/l3color/testfiles/m3color003.tlg
+++ b/l3experimental/l3color/testfiles/m3color003.tlg
@@ -181,3 +181,171 @@ The color mixA has the properties:
<recently read> }
l. ... }
============================================================
+============================================================
+TEST 7: Creating new models
+============================================================
+Defining \c__color_fallback_BarToneCMYK_tl on line ...
+Defining \__color_parse_mix_BarToneCMYK:nw on line ...
+Defining \__color_parse_model_BarToneCMYK:w on line ...
+Defining \__color_backend_BarToneCMYK:n on line ...
+Defining \__color_convert_BarToneCMYK_cmyk:w on line ...
+Defining \__color_convert_BarToneCMYK_rgb:w on line ...
+Defining \__color_convert_BarToneCMYK_gray:w on line ...
+Defining \__color_model_BarToneCMYK_white: on line ...
+Defining \l__color_named_fooCMYK_tl on line ...
+Defining \l__color_named_fooCMYK_prop on line ...
+The color fooCMYK has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.5.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_BarToneRGB_tl on line ...
+Defining \__color_parse_mix_BarToneRGB:nw on line ...
+Defining \__color_parse_model_BarToneRGB:w on line ...
+Defining \__color_backend_BarToneRGB:n on line ...
+Defining \__color_convert_BarToneRGB_rgb:w on line ...
+Defining \__color_convert_BarToneRGB_cmyk:w on line ...
+Defining \__color_convert_BarToneRGB_gray:w on line ...
+Defining \__color_model_BarToneRGB_white: on line ...
+Defining \l__color_named_fooRGB_tl on line ...
+Defining \l__color_named_fooRGB_prop on line ...
+The color fooRGB has the properties:
+> model => BarToneRGB
+> BarToneRGB => 0.5.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_BarToneGray_tl on line ...
+Defining \__color_parse_mix_BarToneGray:nw on line ...
+Defining \__color_parse_model_BarToneGray:w on line ...
+Defining \__color_backend_BarToneGray:n on line ...
+Defining \__color_convert_BarToneGray_cmyk:w on line ...
+Defining \__color_convert_BarToneGray_gray:w on line ...
+Defining \__color_convert_BarToneGray_rgb:w on line ...
+Defining \__color_model_BarToneGray_white: on line ...
+Defining \l__color_named_fooGray_tl on line ...
+Defining \l__color_named_fooGray_prop on line ...
+The color fooGray has the properties:
+> model => BarToneGray
+> BarToneGray => 0.5.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 8: Creating new models: errors
+============================================================
+! LaTeX3 Error: Color model 'BarToneCMYK' already defined.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX was asked to define a new color model called 'BarToneCMYK', but this
+color model already exists.
+! LaTeX3 Error: Unknown color model type 'nope'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to use create a new color model of type 'nope', but this
+type of model is not set up.
+! LaTeX3 Error: Separation color space 'foo2' require a formal name.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ name=<formal name>
+key was given with the correct information.
+! LaTeX3 Error: Separation color space 'foo2' require an alternative model.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ alternative-model=<model>
+key was given with the correct information.
+! LaTeX3 Error: Missing/extra '=' in 'alternative-model' (in '..._keyval:Nn')
+Type <return> to continue.
+ ...
+l. ... }
+LaTeX does not know anything more about this error, sorry.
+Try typing <return> to proceed.
+If that doesn't work, type X <return> to quit.
+! LaTeX3 Error: Separation color space 'foo3' require an alternative model.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ alternative-model=<model>
+key was given with the correct information.
+! LaTeX3 Error: Separation color space 'foo' require an valid alternative
+(LaTeX3) space.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but the model given
+as
+ alternative-model=<model>
+is unknown.
+============================================================
+============================================================
+TEST 9: Converting new models
+============================================================
+> \l_tmpa_tl=BFB2A6.
+<recently read> }
+l. ... }
+> \l_tmpa_tl=0.05 0.1 0.15 0.2.
+<recently read> }
+l. ... }
+> \l_tmpa_tl=EFECE9.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 10: Mixing separations
+============================================================
+Defining \l__color_named_foo_tl on line ...
+Defining \l__color_named_foo_prop on line ...
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.35.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.55.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 11: Mixing separation: failures
+============================================================
+! LaTeX3 Error: No model conversion available from 'gray' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'gray' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+! LaTeX3 Error: No model conversion available from 'cmyk' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'cmyk' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+! LaTeX3 Error: No model conversion available from 'rgb' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'rgb' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+============================================================
diff --git a/l3experimental/l3color/testfiles/m3color003.uptex.tlg b/l3experimental/l3color/testfiles/m3color003.uptex.tlg
index da2336117..b56b4f133 100644
--- a/l3experimental/l3color/testfiles/m3color003.uptex.tlg
+++ b/l3experimental/l3color/testfiles/m3color003.uptex.tlg
@@ -186,3 +186,171 @@ The color mixA has the properties:
<recently read> }
l. ... }
============================================================
+============================================================
+TEST 7: Creating new models
+============================================================
+Defining \c__color_fallback_BarToneCMYK_tl on line ...
+Defining \__color_parse_mix_BarToneCMYK:nw on line ...
+Defining \__color_parse_model_BarToneCMYK:w on line ...
+Defining \__color_backend_BarToneCMYK:n on line ...
+Defining \__color_convert_BarToneCMYK_cmyk:w on line ...
+Defining \__color_convert_BarToneCMYK_rgb:w on line ...
+Defining \__color_convert_BarToneCMYK_gray:w on line ...
+Defining \__color_model_BarToneCMYK_white: on line ...
+Defining \l__color_named_fooCMYK_tl on line ...
+Defining \l__color_named_fooCMYK_prop on line ...
+The color fooCMYK has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.5.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_BarToneRGB_tl on line ...
+Defining \__color_parse_mix_BarToneRGB:nw on line ...
+Defining \__color_parse_model_BarToneRGB:w on line ...
+Defining \__color_backend_BarToneRGB:n on line ...
+Defining \__color_convert_BarToneRGB_rgb:w on line ...
+Defining \__color_convert_BarToneRGB_cmyk:w on line ...
+Defining \__color_convert_BarToneRGB_gray:w on line ...
+Defining \__color_model_BarToneRGB_white: on line ...
+Defining \l__color_named_fooRGB_tl on line ...
+Defining \l__color_named_fooRGB_prop on line ...
+The color fooRGB has the properties:
+> model => BarToneRGB
+> BarToneRGB => 0.5.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_BarToneGray_tl on line ...
+Defining \__color_parse_mix_BarToneGray:nw on line ...
+Defining \__color_parse_model_BarToneGray:w on line ...
+Defining \__color_backend_BarToneGray:n on line ...
+Defining \__color_convert_BarToneGray_cmyk:w on line ...
+Defining \__color_convert_BarToneGray_gray:w on line ...
+Defining \__color_convert_BarToneGray_rgb:w on line ...
+Defining \__color_model_BarToneGray_white: on line ...
+Defining \l__color_named_fooGray_tl on line ...
+Defining \l__color_named_fooGray_prop on line ...
+The color fooGray has the properties:
+> model => BarToneGray
+> BarToneGray => 0.5.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 8: Creating new models: errors
+============================================================
+! LaTeX3 Error: Color model 'BarToneCMYK' already defined.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX was asked to define a new color model called 'BarToneCMYK', but this
+color model already exists.
+! LaTeX3 Error: Unknown color model type 'nope'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to use create a new color model of type 'nope', but this
+type of model is not set up.
+! LaTeX3 Error: Separation color space 'foo2' require a formal name.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ name=<formal name>
+key was given with the correct information.
+! LaTeX3 Error: Separation color space 'foo2' require an alternative model.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ alternative-model=<model>
+key was given with the correct information.
+! LaTeX3 Error: Missing/extra '=' in 'alternative-model' (in '..._keyval:Nn')
+Type <return> to continue.
+ ...
+l. ... }
+LaTeX does not know anything more about this error, sorry.
+Try typing <return> to proceed.
+If that doesn't work, type X <return> to quit.
+! LaTeX3 Error: Separation color space 'foo3' require an alternative model.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ alternative-model=<model>
+key was given with the correct information.
+! LaTeX3 Error: Separation color space 'foo' require an valid alternative
+(LaTeX3) space.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but the model given
+as
+ alternative-model=<model>
+is unknown.
+============================================================
+============================================================
+TEST 9: Converting new models
+============================================================
+> \l_tmpa_tl=BFB2A6.
+<recently read> }
+l. ... }
+> \l_tmpa_tl=0.05 0.1 0.15 0.2.
+<recently read> }
+l. ... }
+> \l_tmpa_tl=EFECE9.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 10: Mixing separations
+============================================================
+Defining \l__color_named_foo_tl on line ...
+Defining \l__color_named_foo_prop on line ...
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.35.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.55.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 11: Mixing separation: failures
+============================================================
+! LaTeX3 Error: No model conversion available from 'gray' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'gray' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+! LaTeX3 Error: No model conversion available from 'cmyk' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'cmyk' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+! LaTeX3 Error: No model conversion available from 'rgb' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'rgb' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+============================================================
diff --git a/l3experimental/l3color/testfiles/m3color003.xetex.tlg b/l3experimental/l3color/testfiles/m3color003.xetex.tlg
index f3bf6e112..b3b3145ac 100644
--- a/l3experimental/l3color/testfiles/m3color003.xetex.tlg
+++ b/l3experimental/l3color/testfiles/m3color003.xetex.tlg
@@ -181,3 +181,171 @@ The color mixA has the properties:
<recently read> }
l. ... }
============================================================
+============================================================
+TEST 7: Creating new models
+============================================================
+Defining \c__color_fallback_BarToneCMYK_tl on line ...
+Defining \__color_parse_mix_BarToneCMYK:nw on line ...
+Defining \__color_parse_model_BarToneCMYK:w on line ...
+Defining \__color_backend_BarToneCMYK:n on line ...
+Defining \__color_convert_BarToneCMYK_cmyk:w on line ...
+Defining \__color_convert_BarToneCMYK_rgb:w on line ...
+Defining \__color_convert_BarToneCMYK_gray:w on line ...
+Defining \__color_model_BarToneCMYK_white: on line ...
+Defining \l__color_named_fooCMYK_tl on line ...
+Defining \l__color_named_fooCMYK_prop on line ...
+The color fooCMYK has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.5.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_BarToneRGB_tl on line ...
+Defining \__color_parse_mix_BarToneRGB:nw on line ...
+Defining \__color_parse_model_BarToneRGB:w on line ...
+Defining \__color_backend_BarToneRGB:n on line ...
+Defining \__color_convert_BarToneRGB_rgb:w on line ...
+Defining \__color_convert_BarToneRGB_cmyk:w on line ...
+Defining \__color_convert_BarToneRGB_gray:w on line ...
+Defining \__color_model_BarToneRGB_white: on line ...
+Defining \l__color_named_fooRGB_tl on line ...
+Defining \l__color_named_fooRGB_prop on line ...
+The color fooRGB has the properties:
+> model => BarToneRGB
+> BarToneRGB => 0.5.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_BarToneGray_tl on line ...
+Defining \__color_parse_mix_BarToneGray:nw on line ...
+Defining \__color_parse_model_BarToneGray:w on line ...
+Defining \__color_backend_BarToneGray:n on line ...
+Defining \__color_convert_BarToneGray_cmyk:w on line ...
+Defining \__color_convert_BarToneGray_gray:w on line ...
+Defining \__color_convert_BarToneGray_rgb:w on line ...
+Defining \__color_model_BarToneGray_white: on line ...
+Defining \l__color_named_fooGray_tl on line ...
+Defining \l__color_named_fooGray_prop on line ...
+The color fooGray has the properties:
+> model => BarToneGray
+> BarToneGray => 0.5.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 8: Creating new models: errors
+============================================================
+! LaTeX3 Error: Color model 'BarToneCMYK' already defined.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX was asked to define a new color model called 'BarToneCMYK', but this
+color model already exists.
+! LaTeX3 Error: Unknown color model type 'nope'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to use create a new color model of type 'nope', but this
+type of model is not set up.
+! LaTeX3 Error: Separation color space 'foo2' require a formal name.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ name=<formal name>
+key was given with the correct information.
+! LaTeX3 Error: Separation color space 'foo2' require an alternative model.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ alternative-model=<model>
+key was given with the correct information.
+! LaTeX3 Error: Missing/extra '=' in 'alternative-model' (in '..._keyval:Nn')
+Type <return> to continue.
+ ...
+l. ... }
+LaTeX does not know anything more about this error, sorry.
+Try typing <return> to proceed.
+If that doesn't work, type X <return> to quit.
+! LaTeX3 Error: Separation color space 'foo3' require an alternative model.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but no
+ alternative-model=<model>
+key was given with the correct information.
+! LaTeX3 Error: Separation color space 'foo' require an valid alternative
+(LaTeX3) space.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a separation color space, but the model given
+as
+ alternative-model=<model>
+is unknown.
+============================================================
+============================================================
+TEST 9: Converting new models
+============================================================
+> \l_tmpa_tl=BFB2A6.
+<recently read> }
+l. ... }
+> \l_tmpa_tl=0.05 0.1 0.15 0.2.
+<recently read> }
+l. ... }
+> \l_tmpa_tl=EFECE9.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 10: Mixing separations
+============================================================
+Defining \l__color_named_foo_tl on line ...
+Defining \l__color_named_foo_prop on line ...
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.35.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 0.55.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 11: Mixing separation: failures
+============================================================
+! LaTeX3 Error: No model conversion available from 'gray' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'gray' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+! LaTeX3 Error: No model conversion available from 'cmyk' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'cmyk' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+! LaTeX3 Error: No model conversion available from 'rgb' to 'BarToneCMYK'.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to convert a color from model 'rgb' to
+model'BarToneCMYK', but there is no method available to do that.
+The color foo has the properties:
+> model => BarToneCMYK
+> BarToneCMYK => 1.
+<recently read> }
+l. ... }
+============================================================
More information about the latex3-commits
mailing list.