diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx new file mode 100644 index 00000000000..5e6eb424d05 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx @@ -0,0 +1,193 @@ +% \iffalse meta-comment +% +%% File: l3draw-state.dtx Copyright(C) 2018 The LaTeX3 Project +% +% It may be distributed and/or modified under the conditions of the +% LaTeX Project Public License (LPPL), either version 1.3c of this +% license or (at your option) any later version. The latest version +% of this license is in the file +% +% http://www.latex-project.org/lppl.txt +% +% This file is part of the "l3experimental bundle" (The Work in LPPL) +% and all files in that bundle must be distributed together. +% +% ----------------------------------------------------------------------- +% +% The development version of the bundle can be found at +% +% https://github.com/latex3/latex3 +% +% for those people who are interested. +% +%<*driver> +\RequirePackage{expl3} +\documentclass[full]{l3doc} +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% +% \title{^^A +% The \pkg{l3draw-state} package\\ Drawing graphics state^^A +% } +% +% \author{^^A +% The \LaTeX3 Project\thanks +% {^^A +% E-mail: +% \href{mailto:latex-team@latex-project.org} +% {latex-team@latex-project.org}^^A +% }^^A +% } +% +% \date{Released 2018/02/21} +% +% \maketitle +% +% \begin{implementation} +% +% \section{\pkg{l3draw-state} implementation} +% +% \begin{macrocode} +%<*initex|package> +% \end{macrocode} +% +% \begin{macrocode} +%<@@=draw> +% \end{macrocode} +% +% \begin{variable}{\g_@@_linewidth_dim, \g_@@_inner_linewidth_dim} +% Linewidth for strokes: global as the scope for this relies on the graphics +% state. The inner line width is used for places where two lines are used. +% \begin{macrocode} +\dim_new:N \g_@@_linewidth_dim +\dim_new:N \g_@@_inner_linewidth_dim +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_draw_default_linewidth_dim} +% A default: this is used at the start of every drawing. +% \begin{macrocode} +\dim_new:N \l_draw_default_linewidth_dim +\dim_set:Nn \l_draw_default_linewidth_dim { 0.4pt } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\draw_linewidth:n, \draw_inner_linewidth:n} +% Set the linewidth: we need a wrapper as this has to pass to the driver +% layer. The inner version is handled at the macro layer but is given a +% consistent interface here. +% \begin{macrocode} +\cs_new_protected:Npn \draw_linewidth:n #1 + { + \dim_gset:Nn \g_@@_linewidth_dim { \fp_to_dim:n {#1} } + \driver_draw_linewidth:n \g_@@_linewidth_dim + } +\cs_new_protected:Npn \draw_inner_linewidth:n #1 + { \dim_gset:Nn \g_@@_inner_linewidth_dim { \fp_to_dim:n {#1} } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\draw_miterlimit:n} +% Pass through to the driver layer. +% \begin{macrocode} +\cs_new_protected:Npn \draw_miterlimit:n #1 + { \driver_draw_miterlimit:n { \fp_to_dim:n {#1} } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro} +% { +% \draw_cap_butt:, \draw_cap_rectangle:, \draw_cap_round:, +% \draw_evenodd_rule:, \draw_nonzero_rule:, +% \draw_join_bevel:, \draw_join_miter:, \draw_join_round: +% } +% All straight wrappers. +% \begin{macrocode} +\cs_new_protected:Npn \draw_cap_butt: { \driver_draw_cap_butt: } +\cs_new_protected:Npn \draw_cap_rectangle: { \driver_draw_cap_rectangle: } +\cs_new_protected:Npn \draw_cap_round: { \driver_draw_cap_round: } +\cs_new_protected:Npn \draw_evenodd_rule: { \driver_draw_evenodd_rule: } +\cs_new_protected:Npn \draw_nonzero_rule: { \driver_draw_nonzero_rule: } +\cs_new_protected:Npn \draw_join_bevel: { \driver_draw_join_bevel: } +\cs_new_protected:Npn \draw_join_miter: { \driver_draw_join_miter: } +\cs_new_protected:Npn \draw_join_round: { \driver_draw_join_round: } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\l_@@_color_tmp_tl} +% Scratch space. +% \begin{macrocode} +\tl_new:N \l_@@_color_tmp_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_fill_color_tl, \g_@@_stroke_color_tl} +% For tracking. +% \begin{macrocode} +\tl_new:N \g_@@_fill_color_tl +\tl_new:N \g_@@_stroke_color_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\draw_color:n, \draw_color_fill:n, \draw_color_stroke:n} +% \begin{macro}{\@@_color:nn} +% \begin{macro}{\@@_color_aux:nn, \@@_color_aux:Vn} +% \begin{macro}{\@@_color:nw} +% \begin{macro} +% { +% \@@_select_cmyk:nw, \@@_select_gray:nw, +% \@@_select_rgb:nw, \@@_split_select:nw +% } +% Much the same as for core color support but calling the relevant +% driver-level function. +% \begin{macrocode} +\cs_new_protected:Npn \draw_color:n #1 + { \@@_color:nn { } {#1} } +\cs_new_protected:Npn \draw_color_fill:n #1 + { \@@_color:nn { fill } {#1} } +\cs_new_protected:Npn \draw_color_stroke:n #1 + { \@@_color:nn { stroke } {#1} } +\cs_new_protected:Npn \@@_color:nn #1#2 + { + \color_parse:nN {#2} \l_@@_color_tmp_tl + \tl_if_blank:nTF {#1} + { + \tl_gset_eq:NN \g_@@_fill_color_tl \l_@@_color_tmp_tl + \tl_gset_eq:NN \g_@@_stroke_color_tl \l_@@_color_tmp_tl + \@@_color_aux:Vn \l_@@_color_tmp_tl { color } + } + { + \tl_gset_eq:cN { g_@@_ #1 _color_tl } \l_@@_color_tmp_tl + \@@_color_aux:Vn \l_@@_color_tmp_tl { #1 } + } + } +\cs_new_protected:Npn \@@_color_aux:nn #1#2 + { \@@_color:nw {#2} #1 \q_stop } +\cs_generate_variant:Nn \@@_color_aux:nn { V } +\cs_new_protected:Npn \@@_color:nw #1#2 ~ #3 \q_stop + { \use:c { @@_color_ #2 :nw } {#1} #3 \q_stop } +\cs_new_protected:Npn \@@_color_cmyk:nw #1#2 ~ #3 ~ #4 ~ #5 \q_stop + { \use:c { driver_draw_ #1 _cmyk:nnnn } {#2} {#3} {#4} {#5} } +\cs_new_protected:Npn \@@_color_gray:nw #1#2 \q_stop + { \use:c { driver_draw_ #1 _gray:n } {#2} } +\cs_new_protected:Npn \@@_color_rgb:nw #1#2 ~ #3 ~ #4 \q_stop + { \use:c { driver_draw_ #1 _rgb:nnn } {#2} {#3} {#4} } +\cs_new_protected:Npn \@@_color_spot:nw #1#2 ~ #3 \q_stop + { \use:c { driver_draw_ #1 _spot:nn } {#2} {#3} } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +%</initex|package> +% \end{macrocode} +% +% \end{implementation} +% +% \PrintIndex |