Debian Codegraph @

texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx

raw
1 % \iffalse meta-comment
2 %
3 %% File: l3draw-state.dtx
4 %
5 % Copyright (C) 2018-2026 The LaTeX Project
6 %
7 % It may be distributed and/or modified under the conditions of the
8 % LaTeX Project Public License (LPPL), either version 1.3c of this
9 % license or (at your option) any later version. The latest version
10 % of this license is in the file
11 %
12 % http://www.latex-project.org/lppl.txt
13 %
14 % This file is part of the "l3experimental bundle" (The Work in LPPL)
15 % and all files in that bundle must be distributed together.
16 %
17 % -----------------------------------------------------------------------
18 %
19 % The development version of the bundle can be found at
20 %
21 % https://github.com/latex3/latex3
22 %
23 % for those people who are interested.
24 %
25 %<*driver>
26 \RequirePackage{expl3}
27 \documentclass[full]{l3doc}
28 \begin{document}
29 \DocInput{\jobname.dtx}
30 \end{document}
31 %</driver>
32 % \fi
33 %
34 % \title{^^A
35 % The \pkg{l3draw-state} package\\ Drawing graphics state^^A
36 % }
37 %
38 % \author{^^A
39 % The \LaTeX{} Project\thanks
40 % {^^A
41 % E-mail:
42 % \href{mailto:[email protected]}
43 % {[email protected]}^^A
44 % }^^A
45 % }
46 %
47 % \date{Released 2026-05-26}
48 %
49 % \maketitle
50 %
51 % \begin{implementation}
52 %
53 % \section{\pkg{l3draw-state} implementation}
54 %
55 % \begin{macrocode}
56 %<*package>
57 % \end{macrocode}
58 %
59 % \begin{macrocode}
60 %<@@=draw>
61 % \end{macrocode}
62 %
63 % This sub-module covers more-or-less the same ideas as
64 % \texttt{pgfcoregraphicstate.code.tex}. At present, equivalents of the
65 % following are currently absent:
66 % \begin{itemize}
67 % \item \cs{pgfsetinnerlinewidth}, \cs{pgfinnerlinewidth},
68 % \cs{pgfsetinnerstrokecolor}, \cs{pgfsetinnerstrokecolor}: Likely to
69 % be added on further work is done on paths/stroking.
70 % \end{itemize}
71 %
72 % \begin{variable}{\g_@@_linewidth_dim}
73 % Linewidth for strokes: global as the scope for this relies on the graphics
74 % state. The inner line width is used for places where two lines are used.
75 % \begin{macrocode}
76 \dim_new:N \g_@@_linewidth_dim
77 % \end{macrocode}
78 % \end{variable}
79 %
80 % \begin{variable}{\l_draw_default_linewidth_dim}
81 % A default: this is used at the start of every drawing.
82 % \begin{macrocode}
83 \dim_new:N \l_draw_default_linewidth_dim
84 \dim_set:Nn \l_draw_default_linewidth_dim { 0.4pt }
85 % \end{macrocode}
86 % \end{variable}
87 %
88 % \begin{macro}{\draw_set_linewidth:n}
89 % Set the linewidth: we need a wrapper as this has to pass to the driver
90 % layer.
91 % \begin{macrocode}
92 \cs_new_protected:Npn \draw_set_linewidth:n #1
93 {
94 \dim_gset:Nn \g_@@_linewidth_dim { \fp_to_dim:n {#1} }
95 \@@_backend_linewidth:n \g_@@_linewidth_dim
96 }
97 % \end{macrocode}
98 % \end{macro}
99 %
100 % \begin{macro}{\draw_set_dash_pattern:nn}
101 % \begin{variable}{\l_@@_tmp_seq}
102 % Evaluated all of the list and pass it to the driver layer.
103 % \begin{macrocode}
104 \cs_new_protected:Npn \draw_set_dash_pattern:nn #1#2
105 {
106 \group_begin:
107 \seq_set_from_clist:Nn \l_@@_tmp_seq {#1}
108 \seq_set_map:NNn \l_@@_tmp_seq \l_@@_tmp_seq
109 { \fp_to_dim:n {##1} }
110 \use:e
111 {
112 \@@_backend_dash_pattern:nn
113 { \seq_use:Nn \l_@@_tmp_seq { , } }
114 { \fp_to_dim:n {#2} }
115 }
116 \group_end:
117 }
118 \seq_new:N \l_@@_tmp_seq
119 % \end{macrocode}
120 % \end{variable}
121 % \end{macro}
122 %
123 % \begin{macro}{\draw_set_miterlimit:n}
124 % Pass through to the driver layer.
125 % \begin{macrocode}
126 \cs_new_protected:Npn \draw_set_miterlimit:n #1
127 { \exp_args:Ne \@@_backend_miterlimit:n { \fp_eval:n {#1} } }
128 % \end{macrocode}
129 % \end{macro}
130 %
131 % \begin{macro}
132 % {
133 % \draw_set_cap_butt:, \draw_set_cap_rectangle:, \draw_set_cap_round:,
134 % \draw_set_evenodd_rule:, \draw_set_nonzero_rule:,
135 % \draw_set_join_bevel:, \draw_set_join_miter:, \draw_set_join_round:
136 % }
137 % All straight wrappers.
138 % \begin{macrocode}
139 \cs_new_protected:Npn \draw_set_cap_butt: { \@@_backend_cap_butt: }
140 \cs_new_protected:Npn \draw_set_cap_rectangle: { \@@_backend_cap_rectangle: }
141 \cs_new_protected:Npn \draw_set_cap_round: { \@@_backend_cap_round: }
142 \cs_new_protected:Npn \draw_set_evenodd_rule: { \@@_backend_evenodd_rule: }
143 \cs_new_protected:Npn \draw_set_nonzero_rule: { \@@_backend_nonzero_rule: }
144 \cs_new_protected:Npn \draw_set_join_bevel: { \@@_backend_join_bevel: }
145 \cs_new_protected:Npn \draw_set_join_miter: { \@@_backend_join_miter: }
146 \cs_new_protected:Npn \draw_set_join_round: { \@@_backend_join_round: }
147 % \end{macrocode}
148 % \end{macro}
149 %
150 % \begin{macrocode}
151 %</package>
152 % \end{macrocode}
153 %
154 % \end{implementation}
155 %
156 % \PrintIndex