diff options
author | Karl Berry <karl@freefriends.org> | 2020-08-07 21:37:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-08-07 21:37:39 +0000 |
commit | d6a7e0e5536b4924edec286797ed38021b94509d (patch) | |
tree | 04407161e6a03a0698d3029183d3959a762a0bb2 /Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx | |
parent | 5a14bab00bc59f46bdb92dcfc08ca2d331e3c3ec (diff) |
l3 (7aug20)
git-svn-id: svn://tug.org/texlive/trunk@56067 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx | 268 |
1 files changed, 12 insertions, 256 deletions
diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx index 1b7d444ae62..7f0f4cfb4ab 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-06-29} +% \date{Released 2020-08-07} % % \maketitle % @@ -56,7 +56,7 @@ % \section{\pkg{l3backend-draw} Implementation} % % \begin{macrocode} -%<*initex|package> +%<*package> %<@@=draw> % \end{macrocode} % @@ -76,13 +76,12 @@ % \end{macro} % % \begin{macro}{\@@_backend_begin:, \@@_backend_end:} -% \begin{macro}{color.fc} % The |ps::[begin]| special here deals with positioning but allows us to % continue on to a matching |ps::[end]|: contrast with |ps:|, which positions % but where we can't split material between separate calls. The % |@beginspecial|/|@endspecial| pair are from |special.pro| and correct the -% scale and $y$-axis direction. The definition of |/color.fc| deals with fill -% color in paths. In contrast to \pkg{pgf}, we don't save the current point: +% scale and $y$-axis direction. +% In contrast to \pkg{pgf}, we don't save the current point: % discussion with Tom Rokici suggested a better way to handle the necessary % translations (see \cs{@@_backend_box_use:Nnnnn}). (Note that % |@beginspecial|/|@endspecial| forms a backend scope.) The |[begin]|/^^A @@ -94,7 +93,6 @@ { \__kernel_backend_literal:n { ps::[begin] } \@@_backend_literal:n { @beginspecial } - \@@_backend_literal:n { SDict ~ begin ~ /color.fc ~ { } ~ def ~ end } } \cs_new_protected:Npn \@@_backend_end: { @@ -103,7 +101,6 @@ } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\@@_backend_scope_begin:, \@@_backend_scope_end:} % Scope here may need to contain saved definitions, so the entire memory @@ -202,7 +199,10 @@ { \@@_backend_literal:n { closepath } } \cs_new_protected:Npn \@@_backend_stroke: { + \@@_backend_literal:n { gsave } + \@@_backend_literal:n { color.sc } \@@_backend_literal:n { stroke } + \@@_backend_literal:n { grestore } \bool_if:NT \g_@@_draw_clip_bool { \@@_backend_literal:x @@ -243,6 +243,7 @@ \cs_new_protected:Npn \@@_backend_fillstroke: { \@@_backend_literal:n { gsave } + \@@_backend_literal:n { color.sc } \@@_backend_literal:n { color.fc } \@@_backend_literal:x { @@ -333,54 +334,6 @@ % \end{macro} % \end{macro} % -% \begin{macro} -% { -% \@@_backend_color_fill_cmyk:n , -% \@@_backend_color_stroke_cmyk:n -% } -% \begin{macro} -% { -% \@@_backend_color_fill_gray:n , -% \@@_backend_color_stroke_gray:n -% } -% \begin{macro} -% { -% \@@_backend_color_fill_rgb:n , -% \@@_backend_color_stroke_rgb:n -% } -% \begin{macro}{\@@_backend_color_fill:n, \@@_backend_color_stroke:n} -% For \texttt{dvips}, we can use the standard color stack to deal with -% stroke color, but for fills have to switch to raw PostScript. This is -% thus not handled by the stack, but the context is very restricted. See -% also how fills are implemented. -% \begin{macrocode} -\cs_new_protected:Npn \@@_backend_color_fill_cmyk:n #1 - { \@@_backend_color_fill:n { #1 ~ setcmykcolor } } -\cs_new_protected:Npn \@@_backend_color_stroke_cmyk:n #1 - { \@@_backend_color_stroke:n { cmyk ~ #1 } } -\cs_new_protected:Npn \@@_backend_color_stroke_gray:n #1 - { \@@_backend_color_fill:n { #1 ~ setgray } } -\cs_new_protected:Npn \@@_backend_color_fill_gray:n #1 - { \@@_backend_color_stroke:n { gray ~ #1 } } -\cs_new_protected:Npn \@@_backend_color_fill_rgb:n #1 - { \@@_backend_color_fill:n { #1 ~ setrgbcolor } } -\cs_new_protected:Npn \@@_backend_color_stroke_rgb:n #1 - { \@@_backend_color_stroke:n { rgb ~ #1 } } -\cs_new_protected:Npn \@@_backend_color_fill:n #1 - { - \__kernel_backend_postscript:n - { /color.fc ~ { #1 } ~ def } - } -\cs_new_protected:Npn \@@_backend_color_stroke:n #1 - { - \__kernel_backend_literal:n { color~push~#1 } - \group_insert_after:N \@@_color_reset: - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\@@_backend_cm:nnnn} % In \texttt{dvips}, keeping the transformations in line with the engine @@ -620,66 +573,6 @@ % \end{macro} % \end{macro} % -% \begin{macro} -% { -% \@@_backend_color_fill_cmyk:n , -% \@@_backend_color_stroke_cmyk:n -% } -% \begin{macro} -% { -% \@@_backend_color_fill_gray:n , -% \@@_backend_color_stroke_gray:n -% } -% \begin{macro} -% { -% \@@_backend_color_fill_rgb:n , -% \@@_backend_color_stroke_rgb:n -% } -% \begin{macro}{\@@_backend_color_select:n, \@@_backend_color_select:x} -% \begin{macro}{\@@_backend_color_reset:} -% Color has to be split between \texttt{(x)dvipdfmx} and the PDF engines -% as there is no color stack for fill/stroke separation in the former. -% \begin{macrocode} -\cs_new_protected:Npn \@@_backend_color_fill_cmyk:n #1 - { \@@_backend_color_select:n { #1 ~ k } } -\cs_new_protected:Npn \@@_backend_color_stroke_cmyk:n #1 - { \@@_backend_color_select:n { #1 ~ K } } -\cs_new_protected:Npn \@@_backend_color_fill_gray:n #1 - { \@@_backend_color_select:n { #1 ~ g } } -\cs_new_protected:Npn \@@_backend_color_stroke_gray:n #1 - { \@@_backend_color_select:n { #1 ~ G } } -\cs_new_protected:Npn \@@_backend_color_fill_rgb:n #1 - { \@@_backend_color_select:n { #1 ~ rg } } -\cs_new_protected:Npn \@@_backend_color_stroke_rgb:n #1 - { \@@_backend_color_select:n { #1 ~ RG } } -%<*pdfmode> -\cs_new_protected:Npx \@@_backend_color_select:n #1 - { - \cs_if_exist:NTF \tex_pdfextension:D - { \tex_pdfextension:D colorstack } - { \tex_pdfcolorstack:D } - \exp_not:N \l__kernel_color_stack_int push {#1} - \group_insert_after:N \exp_not:N \@@_backend_color_reset: - } -\cs_new_protected:Npx \@@_backend_color_reset: - { - \cs_if_exist:NTF \tex_pdfextension:D - { \tex_pdfextension:D colorstack } - { \tex_pdfcolorstack:D } - \exp_not:N \l__kernel_color_stack_int pop \scan_stop: - } -%</pdfmode> -%<*dvipdfmx|xdvipdfmx> -\cs_new_eq:NN \@@_backend_color_select:n \__kernel_backend_literal_pdf:n -%</dvipdfmx|xdvipdfmx> -\cs_generate_variant:Nn \@@_backend_color_select:n { x } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}{\@@_backend_cm:nnnn} % \begin{macro}{\@@_backend_cm_aux:nnnn} % Another split here between \texttt{pdfmode} and \texttt{(x)dvipdfmx}. @@ -883,54 +776,11 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_backend_begin: { - \@@_backend_scope_begin: - \@@_backend_scope:n { transform="translate({?x},{?y})~scale(1,-1)" } - } -\cs_new_protected:Npn \@@_backend_end: - { \@@_backend_scope_end: } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_backend_scope_begin:, \@@_backend_scope_end:} -% \begin{macro}{\@@_backend_scope:n, \@@_backend_scope:x} -% \begin{variable}{\g_@@_draw_scope_int, \l_@@_draw_scope_int} -% Several settings that with other backends are \enquote{stand alone} have -% to be given as part of a scope in SVG. As a result, there is a need to -% provide a mechanism to automatically close these extra scopes. That is -% done using a dedicated function and a pair of tracking variables. Within -% each graphics scope we use a global variable to do the work, with a group -% used to save the value between scopes. The result is that no direct action -% is needed when creating a scope. -% \begin{macrocode} -\cs_new_protected:Npn \@@_backend_scope_begin: - { - \int_set_eq:NN - \l_@@_draw_scope_int - \g_@@_draw_scope_int - \group_begin: - \int_gzero:N \g_@@_draw_scope_int - } -\cs_new_protected:Npn \@@_backend_scope_end: - { - \prg_replicate:nn - { \g_@@_draw_scope_int } - { \@@_backend_literal:n { </g> } } - \group_end: - \int_gset_eq:NN - \g_@@_draw_scope_int - \l_@@_draw_scope_int - } -\cs_new_protected:Npn \@@_backend_scope:n #1 - { - \@@_backend_literal:n { <g~ #1 > } - \int_gincr:N \g_@@_draw_scope_int + \__kernel_backend_scope_begin: + \__kernel_backend_scope:n { transform="translate({?x},{?y})~scale(1,-1)" } } -\cs_generate_variant:Nn \@@_backend_scope:n { x } -\int_new:N \g_@@_draw_scope_int -\int_new:N \l_@@_draw_scope_int +\cs_new_eq:NN \@@_backend_end: \__kernel_backend_scope_end: % \end{macrocode} -% \end{variable} -% \end{macro} % \end{macro} % % \begin{macro}{\@@_backend_moveto:nn, \@@_backend_lineto:nn} @@ -1158,100 +1008,6 @@ % \end{macro} % \end{macro} % -% \begin{macro} -% { -% \@@_backend_color_fill_cmyk:n , -% \@@_backend_color_stroke_cmyk:n -% } -% \begin{macro}{\@@_backend_color_cmyk:nw} -% \begin{macro} -% { -% \@@_backend_color_fill_gray:n , -% \@@_backend_color_stroke_gray:n -% } -% \begin{macro}{\@@_backend_color_gray:nn, \@@_backend_color_gray_aux:n} -% \begin{macro} -% { -% \@@_backend_color_fill_rgb:n , -% \@@_backend_color_stroke_rgb:n -% } -% \begin{macro}{\@@_backend_color_rgb:nw} -% \begin{macro}{\@@_backend_color:nnnn} -% For drawings in SVG, we use scopes for all colors. That -% requires using \texttt{RGB} values, which luckily are easy to -% convert here (|cmyk| to |RGB| is a fixed function). -% \begin{macrocode} -\cs_new_protected:Npn \@@_backend_color_fill_cmyk:n #1 - { \@@_backend_color_cmyk:nw { fill } #1 \s_@@_stop } -\cs_new_protected:Npn \@@_backend_color_stroke_cmyk:n #1 - { \@@_backend_color_cmyk:nw { stroke } #1 \s_@@_stop } -\cs_new_protected:Npn \@@_backend_color_cmyk:nw - #1#2 ~ #3 ~ #4 ~ #5 \s_@@_stop - { - \use:x - { - \@@_backend_color:nnnn - {#1} - { \fp_eval:n { -100 * ( 1 - min ( 1 , #2 + #5 ) ) } } - { \fp_eval:n { -100 * ( 1 - min ( 1 , #3 + #5 ) ) } } - { \fp_eval:n { -100 * ( 1 - min ( 1 , #4 + #5 ) ) } } - } - } -\cs_new_protected:Npn \@@_backend_color_fill_gray:n #1 - { \@@_backend_color_grab:nn { fill } {#1} } -\cs_new_protected:Npn \@@_backend_color_stroke_gray:n #1 - { \@@_backend_color_grab:nn { stroke } {#1} } -\cs_new_protected:Npn \@@_backend_color_gray:nn #1#2 - { - \use:x - { - \@@_backend_color_gray_aux:nn - {#1} - { \fp_eval:n { 100 * (#2) } } - } - } -\cs_new_protected:Npn \@@_backend_color_gray_aux:nn #1#2 - { \@@_backend_color:nnn {#1} {#2} {#2} {#2} } -\cs_new_protected:Npn \@@_backend_color_fill_rgb:n #1 - { \@@_backend_color_rgb:nw { fill } #1 \s_@@_stop } -\cs_new_protected:Npn \@@_backend_color_stroke_rgb:n #1 - { \@@_backend_color_rgb:nw { stroke } #1 \s_@@_stop } -\cs_new_protected:Npn \@@_backend_color_rgb:nw - #1#2 ~ #3 ~ #4\s_@@_stop - { - \use:x - { - \@@_backend_color:nnnn - { fill } - { \fp_eval:n { 100 * (#2) } } - { \fp_eval:n { 100 * (#3) } } - { \fp_eval:n { 100 * (#4) } } - } - } -\cs_new_protected:Npx \@@_backend_color:nnnn #1#2#3#4 - { - \@@_backend_scope:n - { - #1 = - " - rgb - ( - #2 \c_percent_str , - #3 \c_percent_str , - #4 \c_percent_str - ) - " - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}{\@@_backend_cm:nnnn} % The four arguments here are floats (the affine matrix), the last % two are a displacement vector. @@ -1298,7 +1054,7 @@ % \end{macrocode} % % \begin{macrocode} -%</initex|package> +%</package> % \end{macrocode} % % \end{implementation} |