summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw.dtx
blob: 081d42e7f36b0f0a74851e75021e5ce01fdc4847 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
% \iffalse meta-comment
%
%% File: l3draw.dtx
%
% Copyright(C) 2018-2020 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|package>
\RequirePackage{expl3}
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
\usepackage{l3draw}
% For creating code demonstrations
% This needs access to some code-level interfaces in listings
\usepackage{listings}
\makeatletter
\lst@RequireAspects{writefile}
\newsavebox\demo@box
\lstnewenvironment{demo}[1][code and example]
  {%
    \global\let\lst@intname\@empty
    \edef\demo@end{%
      \expandafter\noexpand\csname demo@@#1@end\endcsname
    }%
    \@nameuse{demo@@#1}%
  }
  {\demo@end}
\newcommand\demo@new[3]{%
  \@namedef{demo@@#1}{#2}%
  \@namedef{demo@@#1@end}{#3}%
}
\newcommand*\demo@common{%
  \setkeys{lst}
    {%
       basicstyle   = \small\ttfamily,
       basewidth    = 0.51em,
       gobble       = 5,
       language     = [LaTeX]{TeX},
    }%
}
\newcommand*\demo@input{%
  \ExplSyntaxOn
  \catcode`\^^M = 10\relax
  \catcode`\% = 14\relax
  \input{\jobname.tmp}%
  \ExplSyntaxOff
}
\demo@new{code and example}{%
  \setbox\demo@box=\hbox\bgroup
    \lst@BeginAlsoWriteFile{\jobname.tmp}%
    \demo@common
}{%
    \lst@EndWriteFile
  \egroup
  \begin{center}
    \ifdim\wd\demo@box > 0.75\linewidth
      \begin{minipage}{\linewidth}
        \usebox\demo@box
      \end{minipage}%
      \par
      \begin{minipage}{\linewidth}
        \demo@input
      \end{minipage}
    \else
      \begin{minipage}{0.25\linewidth}
        \demo@input
      \end{minipage}%
      \hfil
      \begin{minipage}{0.75\linewidth}
        \usebox\demo@box
      \end{minipage}%
    \fi
  \end{center}
}
\makeatother
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \title{^^A
%   The \pkg{l3draw} package\\ Core drawing support^^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 2020-07-17}
%
% \maketitle
%
% \begin{documentation}
%
% \section{\pkg{l3draw} documentation}
%
% The \pkg{l3draw} package provides a set of tools for creating (vector)
% drawings in \pkg{expl3}. It is heavily inspired by the \pkg{pgf} layer of
% the Ti\textit{k}Z system, with many of the interfaces having the same form.
% However, the code provided here is build entirely on core \pkg{expl3} ideas
% and uses the \LaTeX3 FPU for numerical support.
%
% Numerical expressions in \pkg{l3draw} are handled as floating point
% expressions, unless otherwise noted. This means that they may contain or
% omit explicit units. Where units are omitted, they will automatically be
% taken as given in (\TeX{}) points.
%
% The code here is \emph{highly} experimental.
%
% \subsection{Drawings}
%
% \begin{function}{\draw_begin:, \draw_end:}
%   \begin{syntax}
%     \cs{draw_begin:}
%     ...
%     \cs{draw_end:}
%   \end{syntax}
%   Each drawing should be created within a \cs{draw_begin:}/\cs{draw_end:}
%   function pair. The \texttt{begin} function sets up a number of key
%   data structures for the rest of the functions here: unless otherwise
%   specified, use of |\draw_...| functions outside of this
%   \enquote{environment} is \emph{not supported}.
%
%   The drawing created within the environment will be inserted into
%   the typesetting stream by the \cs{draw_end:} function, which will
%   switch out of vertical mode if required.
%   \begin{demo}
%     \dim_new:N \l_mypos_dim
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , \l_mypos_dim }
%       \draw_path_lineto:n { 1cm , \l_mypos_dim }
%       \dim_set:Nn \l_mypos_dim { 1cm }
%       \draw_path_lineto:n { 1cm , \l_mypos_dim }
%       \draw_path_close:
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
%
%   Within a drawing, the only commands that should appear are those directly
%   aimed at drawing (from \pkg{l3draw}) and those which produce \emph{no}
%   typeset output. For example, it is possible to include loops inside a
%   drawing using |\int_step_function:nnnn| or similar. On the other hand,
%   text should not be included directly in drawings, but should rather be
%   inserted using the appropriate \pkg{l3draw} command.
%
%   The drawing environment sets the following standard behaviors
%   \begin{itemize}
%      \item Non-zero rule for fill overlaps
%      \item Butt caps for lines
%      \item Mitering for line joins with a miter factor of $10$
%      \item Solid line strokes
%   \end{itemize}
% \end{function}
%
% Within a drawing, there are different ways of referring to a position.
% The co-ordinates of a point are given relative to the current
% \emph{drawing axes}. These can be manipulated and tracked at the code
% level. Underlying this is the \meta{canvas}, which is at the \pkg{draw}
% level essentially fixed and in line with the paper. Initially, the two
% sets of axes are coincident. (It is possible to manipulate the canvas
% axes at the driver level: this is then \enquote{transparent} to the
% \pkg{draw} level, and so should be used only when strictly required.)
%
% \begin{function}{\draw_suspend_begin:, \draw_suspend_end:}
%   \begin{syntax}
%     \cs{draw_suspend_begin:}
%     ...
%     \cs{draw_suspend_end:}
%   \end{syntax}
%   Suspends all of the drawing mechanisms to allow \enquote{normal}
%   material to be created. Typically, this environment will be applied
%   inside a box which may contain nested pictures.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , 0cm }
%       \hbox_set:Nn \l_tmpa_box
%         {
%           \draw_suspend_begin:
%             This~is~normal~text.
%             \draw_begin: % A subpicture
%               \draw_path_moveto:n { 1cm , 0cm }
%               \draw_path_lineto:n { 1cm , 1cm }
%               \draw_path_use_clear:n { stroke }
%             \draw_end:
%             More~text.
%           \draw_suspend_end:
%         }
%       \draw_box_use:N \l_tmpa_box
%       \draw_path_lineto:n { 0cm , 1cm }
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \subsection{Graphics state}
%
% Within the drawing environment, a number of functions control how drawings
% will appear. Note that these all apply \emph{globally}, though some are
% rest at the start of each drawing (\cs{draw_begin:}).
%
% \begin{variable}{\g_draw_linewidth_default_dim}
%   The default value of the linewidth for stokes, set at the start
%   of every drawing (\cs{draw_begin:}).
% \end{variable}
%
% \begin{function}{\draw_linewidth:n}
%   \begin{syntax}
%     \cs{draw_linewidth:n} \Arg{width}
%   \end{syntax}
%   Sets the width to be used for stroking to the \meta{width} (an 
%   \meta{fp expr}).
% \end{function}
%
% \begin{function}{\draw_dash_pattern:nn}
%   \begin{syntax}
%     \cs{draw_dash_pattern:nn} \Arg{pattern} \Arg{phase}
%   \end{syntax}
%   Specifies a dash pattern. The \meta{pattern} itself is a comma-separated
%   list of entries which represent the \enquote{on} and \enquote{off}
%   parts of the line. These are all \meta{fp expr} and repeat as required.
%   Thus the \meta{pattern} may be of arbitrary length. The \meta{phase}
%   specifies where during the first \enquote{on} line the pattern should
%   start.
%   \begin{demo}
%     \draw_begin:
%       \draw_dash_pattern:nn
%         { 0.5cm , 0.5cm , 0.1cm , 0.2cm }
%         { 0cm }
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_lineto:n { 2cm , 0cm }
%       \draw_path_use_clear:n { stroke }
%       \draw_dash_pattern:nn
%         { 0.5cm , 0.5cm , 0.1cm , 0.2cm }
%         { 0.1cm }
%       \draw_path_moveto:n { 0cm , 1mm }
%       \draw_path_lineto:n { 2cm , 1mm }
%       \draw_path_use_clear:n { stroke }
%       \draw_dash_pattern:nn
%         { 0.5cm , 0.5cm , 0.1cm , 0.2cm }
%         { 0.2cm }
%       \draw_path_moveto:n { 0cm , 2mm }
%       \draw_path_lineto:n { 2cm , 2mm }
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
%   Setting an empty pattern will produce a solid line.
%   
%   Note the \meta{pattern} interface here is different from that in \pkg{pgf}:
%   the list is comma-separated not given in brace groups.
% \end{function}
%
% \begin{function}{\draw_nonzero_rule:, \draw_evenodd_rule:}
%   \begin{syntax}
%     \cs{draw_nonzero_rule:}
%   \end{syntax}
%   Active either the non-zero winding number or the even-odd rule,
%   respectively, for determining what is inside a fill or clip area.
%   For technical reasons, these command are not influenced by scoping
%   and apply on an ongoing basis.
% \end{function}
%
% \begin{function}
%   {
%     \draw_cap_butt:      ,
%     \draw_cap_rectangle: ,
%     \draw_cap_round:
%   }
%   \begin{syntax}
%     \cs{draw_cap_butt:}
%   \end{syntax}
%   Sets the style of terminal stroke position to one of butt, rectangle or
%   round.
% \end{function}
%
% \begin{function}
%   {
%     \draw_join_bevel: ,
%     \draw_join_miter: ,
%     \draw_join_round:
%   }
%   \begin{syntax}
%     \cs{draw_cap_butt:}
%   \end{syntax}
%   Sets the style of stroke joins to one of bevel, miter or round.
% \end{function}
%
% \begin{function}{\draw_miterlimit:n}
%   \begin{syntax}
%     \cs{draw_miterlimit:n} \Arg{factor}
%   \end{syntax}
%   Sets the miter \meta{factor} of lines joined as a miter, as described in the
%   PDF and PostScript manuals. The \meta{factor} is an \meta{fp expr}.
% \end{function}
%
% \subsection{Scoping drawing elements}
%
% Scoping drawing elements is necessary to allowing nesting of subparts.
% These features have specific use requirements: the preconditions must be
% met. In particular, each type of drawing scope also constitutes a
% group (\cs{group_begin:}/\cs{group_end:} pair): as such, they must be
% nested correctly.
%
% \begin{function}{\draw_scope_begin:, \draw_scope_end:}
%   \begin{syntax}
%     \cs{draw_scope_begin:}
%     ...
%     \cs{draw_scope_end:}
%   \end{syntax}
%   Creates a scope for localisation of state settings within a drawing.
%   A scope forms a \TeX{} group but will also localise global state
%   variables (such as \cs{g_draw_linewidth_default_dim}), and driver-level
%   concepts such as the termination of lines.
%   \begin{demo}
%     \draw_begin:
%       \draw_scope_begin:
%         \group_begin:
%           \draw_linewidth:n { 2pt }
%           \draw_path_rectangle:nn { 0 , 0 } { 2ex , 2ex }
%           \draw_path_use:n  { stroke }
%         \group_end:
%         \draw_path_rectangle:nn { 3ex , 0ex } { 2ex , 2ex }
%         \draw_path_use:n  { stroke }
%       \draw_scope_end:
%       \draw_path_rectangle:nn { 6ex , 0ex } { 2ex , 2ex }
%       \draw_path_use_clear:n  { stroke }
%     \draw_end:
%   \end{demo}
%   Global graphical concepts restricted by scope are
%   \begin{itemize}
%     \item Line width
%     \item Stroke and fill color
%     \item Dash pattern
%     \item Line joining and capping, including the miter limit
%     \item Clipping paths
%     \item Canvas (driver) transformations
%   \end{itemize}
% \end{function}
%
% \subsection{Points}
%
% Functions supporting the calculation of points (co-ordinates) are expandable
% and may be used outside of the drawing environment. When used in this
% way, they all yield a co-ordinate tuple, for example
% \begin{verbatim}
%   \tl_set:Nx \l_tmpa_tl { \draw_point:nn { 1 } { 2 } }
%   \tl_show:N \l_tmpa_tl
% \end{verbatim}
% gives
% \begin{verbatim}
%   > \l_tmpa_tl=1pt,2pt.
%   <recently read> }
% \end{verbatim}
%
% This output form is then suitable as \emph{input} for subsequent point
% calculations, \emph{i.e.}~where a \meta{point} is required it may be
% given as a tuple. This \emph{may} include units and surrounding
% parentheses, for example
% \begin{verbatim}
%   1,2
%   (1,2)
%   1cm,3pt
%   (1pt,2cm)
%   2 * sind(30), 2^4in
% \end{verbatim}
% are all valid input forms. Notice that each part of the tuple may itself
% be a float point expression.
%
% Point co-ordinates are relative to the canvas axes, but can be transformed
% by \cs{draw_point_transform:n}. These manipulation is applied by many
% higher-level functions, for example path construction, and allows parts of
% a drawing to be rotated, scaled or skewed. This occurs before writing any
% data to the driver, and so such manipulations are tracked by the drawing
% mechanisms. See \cs{@@_backend_cm:nnnn} for backend-level
% manipulation of the canvas axes themselves.
%
% Notice that in contrast to \pkg{pgf} it is possible to give the positions
% of points \emph{directly}.
%
% \subsubsection{Basic point functions}
%
% \begin{function}[EXP]{\draw_point_polar:nn, \draw_point_polar:nnn}
%   \begin{syntax}
%     \cs{draw_point_polar:nn} \Arg{radius} \Arg{angle}
%     \cs{draw_point_polar:nnn} \Arg{radius-a} \Arg{radius-b} \Arg{angle}
%   \end{syntax}
%   Gives the co-ordinates of the point at \meta{angle} (an \meta{fp expr} in
%   \emph{degrees}) and \meta{radius}. The three-argument version accepts
%   two radii of different lengths.
%   
%   Note the interface here is somewhat different from that in \pkg{pgf}:
%   the one- and two-radii versions in \pkg{l3draw} use separate functions,
%   whilst in \pkg{pgf} they use the same function and a keyword.
% \end{function}
%
% \begin{function}[EXP]{\draw_point_unit_vector:n}
%   \begin{syntax}
%     \cs{draw_point_unit_vector:n} \Arg{point}
%   \end{syntax}
%   Expands to the co-ordinates of a unit vector in the direction of the
%   \meta{point} from the origin. If the \meta{point} is at the origin,
%   a vertical unit vector is returned
% \end{function}
%
% \begin{function}[EXP]{\draw_point_transform:n}
%   \begin{syntax}
%     \cs{draw_point_transform:n} \Arg{point}
%   \end{syntax}
%   Evaluates the position of the \meta{point} subject to the current
%   transformation matrix. This operation is applied automatically by
%   most higher-level functions (\emph{e.g.}~path manipulations).
% \end{function}
%
% \subsubsection{Points on a vector basis}
%
% As well as giving explicit values, it is possible to describe points
% in terms of underlying direction vectors. The latter are initially
% co-incident with the standard Cartesian axes, but may be altered by
% the user.
%
% \begin{function}{\draw_xvec:n, \draw_yvec:n, \draw_zvec:n}
%   \begin{syntax}
%     \cs{draw_xvec:n} \Arg{point}
%   \end{syntax}
%   Defines the appropriate base vector to point toward the \meta{point}
%   on the canvas. The standard settings for the $x$- and $y$-vectors are
%   $1\,\mathrm{cm}$ along the relevant canvas axis, whilst for the
%   $z$-vector an appropriate direction is taken.
% \end{function}
%
% \begin{function}[EXP]{\draw_point_vec:nn, \draw_point_vec:nnn}
%   \begin{syntax}
%     \cs{draw_point_vec:nn} \Arg{xscale} \Arg{yscale}
%     \cs{draw_point_vec:nnn} \Arg{xscale} \Arg{yscale} \Arg{zscale}
%   \end{syntax}
%   Expands to the co-ordinate of the point at \meta{xscale} times the
%   $x$-vector and \meta{yscale} times the $y$-vector. The three-argument
%   version extends this to include the $z$-vector.
% \end{function}
%
% \begin{function}[EXP]{\draw_point_vec_polar:nn, \draw_point_vec_polar:nnn}
%   \begin{syntax}
%     \cs{draw_point_vec_polar:nn} \Arg{radius} \Arg{angle}
%     \cs{draw_point_vec_polar:nnn} \Arg{radius-a} \Arg{radius-b} \Arg{angle}
%   \end{syntax}
%   Gives the co-ordinates of the point at \meta{angle} (an \meta{fp expr} in
%   \emph{degrees}) and \meta{radius}, relative to the prevailing
%   $x$- and $y$-vectors. The three-argument version accepts two radii of
%   different lengths.
%   
%   Note the interface here is somewhat different from that in \pkg{pgf}:
%   the one- and two-radii versions in \pkg{l3draw} use separate functions,
%   whilst in \pkg{pgf} they use the same function and a keyword.
% \end{function}
%
% \subsubsection{Intersections}
%
% \begin{function}[EXP]{\draw_point_intersect_lines:nnnn}
%   \begin{syntax}
%     \cs{draw_point_intersect_lines:nnnn} \Arg{point1} \Arg{point2} \Arg{point3} \Arg{point4}
%   \end{syntax}
%   Evaluates the point at the intersection of one line, joining
%   \meta{point1} and \meta{point2}, and a second line joining \meta{point3}
%   and \meta{point4}. If the lines do not intersect, or are coincident, and
%   error will occur.
% \end{function}
%
% \begin{function}[EXP]{\draw_point_intersect_circles:nnnnn}
%   \begin{syntax}
%     \cs{draw_point_intersect_circles:nnnnn}
%       \Arg{center1} \Arg{radius1} \Arg{center2} \Arg{radius2} \Arg{root}
%   \end{syntax}
%   Evaluates the point at the intersection of one circle with
%   \meta{center1} and \meta{radius1}, and a second circle with \meta{center2}
%   and \meta{radius2}. If the circles do not intersect, or are coincident, and
%   error will occur.
%
%   Note the interface here has a different argument ordering from that in
%   \pkg{pgf}, which has the two centers then the two radii.
% \end{function}
%
% \subsubsection{Interpolations}
%
% \begin{function}[EXP]{\draw_point_interpolate_line:nnn}
%   \begin{syntax}
%     \cs{draw_point_interpolate_line:nnn} \Arg{part} \Arg{point1} \Arg{point2}
%   \end{syntax}
%   Expands to the point which is \meta{part} way along the line joining
%   \meta{point1} and \meta{point2}. The \meta{part} may be an interpolation or
%   an extrapolation, and is a floating point value expressing a percentage
%   along the line, \emph{e.g.}~a value of \texttt{0.5} would be half-way
%   between the two points.
% \end{function}
%
% \begin{function}[EXP]{\draw_point_interpolate_distance:nnn}
%   \begin{syntax}
%     \cs{draw_point_interpolate_distance:nnn} \Arg{distance} \Arg{point expr1} \Arg{point expr2}
%   \end{syntax}
%   Expands to the point which is \meta{distance} way along the line joining
%   \meta{point1} and \meta{point2}. The \meta{distance} may be an interpolation
%   or an extrapolation.
% \end{function}
%
% \begin{function}[EXP]{\draw_point_interpolate_curve:nnnnnn}
%   \begin{syntax}
%     \cs{draw_point_interpolate_curve:nnnnnn} \Arg{part}
%       \Arg{start} \Arg{control1} \Arg{control2} \Arg{end}
%   \end{syntax}
%   Expands to the point which is \meta{part} way along the curve between
%   \meta{start} and \meta{end} and defined by \meta{control1} and
%   \meta{control2}. The \meta{part} may be an interpolation or
%   an extrapolation, and is a floating point value expressing a percentage
%   along the curve, \emph{e.g.}~a value of \texttt{0.5} would be half-way
%   along the curve.
% \end{function}
%
% \subsection{Paths}
%
% Paths are constructed by combining one or more operations before applying
% one or more actions. Thus until a path is \enquote{used}, it may be
% manipulated or indeed discarded entirely. Only one path is active at
% any one time, and the path is \emph{not} affected by \TeX{} grouping.
%
% \begin{function}{\draw_path_corner_arc:nn}
%   \begin{syntax}
%     \cs{draw_path_corner_arc:n} \Arg{length1} \Arg{length2}
%   \end{syntax}
%   Sets the degree of rounding applied to corners in a path: the two
%   \meta{length} values are the distances from the corner at which the curving
%   should start. The first \meta{length} applies to the part of the path
%   \enquote{leading in} to the corner (\emph{i.e.}~from the previous path
%   operation), and the second to that \enquote{leading out}. If both
%   values are \texttt{0pt} then corners will not be rounded. The values
%   apply within the scope of the current \TeX{} group.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_corner_arc:nn { 5mm } { 5mm }
%       \draw_path_rectangle_corners:nn
%         { 0cm , 0cm } { 3cm , 2cm }
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
%   \begin{demo}
%     \draw_begin:
%       \draw_path_corner_arc:nn { 10mm } { 5mm }
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_lineto:n { 0cm , 2cm }
%       \draw_path_lineto:n { 3cm , 2cm }
%       \draw_path_curveto:nnn
%         { 3cm , 0cm } { 2cm , 0cm } { 1cm , 0cm }
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
%   The corners created are quarter-circles for exact right-angles and
%   close approximations otherwise. Closing a path will result in rounding
%   correctly.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_corner_arc:nn { 4pt } { 4pt }
%       \draw_path_moveto:n
%         { \draw_point_polar:nn { 1cm } { 0 } }
%       \int_step_inline:nnnn { 72 } { 72 } { 359 }
%         {
%           \draw_path_lineto:n
%             { \draw_point_polar:nn { 1cm } { #1 } }
%         }
%        \draw_path_close:
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \begin{function}{\draw_path_close:}
%   \begin{syntax}
%     \cs{draw_path_close:}
%   \end{syntax}
%   Closes the current part of the path by appending a straight line from
%   the current point to the starting point of the path. In general, any
%   path to be \emph{filled} should include a close instructions.
% \end{function}
%
% \begin{function}{\draw_path_use:n, \draw_path_use_clear:n}
%   \begin{syntax}
%     \cs{draw_path_use:n} \Arg{action(s)}
%   \end{syntax}
%   Inserts the current path, carrying out one ore more possible \meta{actions}
%   (a comma list):
%   \begin{itemize}
%     \item \texttt{stroke} Draws a line along the current path
%     \item \texttt{draw} A synonym for \texttt{stroke}
%     \item \texttt{fill} Fills the interior of the path with the current
%       file color
%     \item \texttt{clip} Clips any content outside of the path
%   \end{itemize}
%   Actions are applied in the order given irrespective of the input order.
%   Note that whilst it is possible to use a path without clearing it, the
%   normal use case would be to clear the path (this resets data structures
%   at the macro level).
% \end{function}
%
% \subsubsection{Path operations on drawing axes}
%
% The standard path functions are all influenced by the active transformation
% matrix, \emph{i.e.}~the work relative to the drawing axes rather than
% the canvas.
%
% \begin{function}{\draw_path_moveto:n}
%   \begin{syntax}
%     \cs{draw_path_moveto:n} \Arg{point}
%   \end{syntax}
%   Moves the reference point of the path to the \meta{point}, but will
%   not join this to any previous point.
% \end{function}
%
% \begin{function}{\draw_path_lineto:n}
%   \begin{syntax}
%     \cs{draw_path_lineto:n} \Arg{point}
%   \end{syntax}
%   Joins the current path to the \meta{point} with a straight line.
%   In general, for reliable treatment by viewers, a \cs{draw_path_moveto:n}
%   operation should precede the first use of a \cs{draw_path_lineto:n}
%   on a path.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_lineto:n { 1cm , 1cm }
%       \draw_path_lineto:n { 2cm , 1cm }
%       \draw_path_lineto:n { 3cm , 0.5cm }
%       \draw_path_lineto:n { 3cm , 0cm }
%       \draw_color_fill:n {  yellow!80!black }
%       \draw_path_use_clear:n { fill , stroke }
%     \draw_end:
%   \end{demo}
%   \begin{demo}
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_lineto:n { 1cm , 1cm }
%       \draw_path_lineto:n { 2cm , 1cm }
%       \draw_path_moveto:n { 2cm , 1cm }  % Begins a new part
%       \draw_path_lineto:n { 3cm , 0.5cm }
%       \draw_path_lineto:n { 3cm , 0cm }
%       \draw_color_fill:n {  yellow!80!black }
%       \draw_path_use_clear:n { fill , stroke }
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \begin{function}{\draw_path_curveto:nnn}
%   \begin{syntax}
%     \cs{draw_path_curveto:nnn} \Arg{control1} \Arg{control2} \Arg{end}
%   \end{syntax}
%   Joins the current path to the \meta{end} with a curved line defined by
%   cubic Bézier points \meta{control1} and \meta{control2}. The bounding box
%   of the path (and image) will fully-contain the curve and control points,
%   \emph{i.e.}~it may be bigger than strictly necessary to contain the curve
%   \emph{alone}.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_curveto:nnn
%         { 1cm , 1cm } % First control
%         { 2cm , 1cm } % Second control
%         { 3cm , 0cm } % End
%       \draw_color_fill:n {  yellow!80!black }
%       \draw_path_use_clear:n { fill , stroke }
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \begin{function}{\draw_path_curveto:nn}
%   \begin{syntax}
%     \cs{draw_path_curveto:nn} \Arg{control} \Arg{end}
%   \end{syntax}
%   Joins the current path to the \meta{end} with a curved line defined by
%   quadratic Bézier point \meta{control}. The bounding box
%   of the path (and image) will fully-contain the curve and computed (cubic)
%   control points, \emph{i.e.}~it may be bigger than strictly necessary to
%   contain the curve \emph{alone}.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_curveto:nn
%         { 1cm , 1cm }
%         { 2cm , 0cm }
%       \draw_color_fill:n {  yellow!80!black }
%       \draw_path_use_clear:n { fill , stroke }
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \begin{function}{\draw_path_arc:nnn, \draw_path_arc:nnnn}
%   \begin{syntax}
%     \cs{draw_path_arc:nnn} \Arg{angle1} \Arg{angle2} \Arg{radius}
%     \cs{draw_path_arc:nnnn} \Arg{angle1} \Arg{angle2} \Arg{radius-a} \Arg{radius-b}
%   \end{syntax}
%   Joins the current path with an arc between \meta{angle1} and \meta{angle2}
%   and of \meta{radius}. The four-argument version accepts two radii of
%   different lengths.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_lineto:n { 0cm , 1cm }
%       \draw_path_arc:nnn { 180 } { 90 } { 0.5cm }
%       \draw_path_lineto:n { 3cm , 1.5cm }
%       \draw_path_arc:nnn { 90 } { -45 } { 0.5cm }
%       \draw_path_use_clear:n { fill }
%     \draw_end:
%   \end{demo}
%
%   Note the interface here has a different argument ordering from that in
%   \pkg{pgf}, which has the two centers then the two radii.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_arc:nnnn { 180 } { 45 } { 2cm } { 1cm }
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \begin{function}{\draw_path_arc_axes:nnnn}
%   \begin{syntax}
%     \cs{draw_path_arc_axes:nnn} \Arg{angle1} \Arg{angle2} \Arg{vector1} \Arg{vector2}
%   \end{syntax}
%   Appends the portion of an ellipse from \meta{angle1} to \meta{angle2} of an
%   ellipse with axes along \meta{vector1} and \meta{vector2} to the current
%   path.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_lineto:n { 2cm , 5mm }
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_lineto:n { 0cm , 1cm }
%       \draw_path_moveto:n { 2cm , 5mm }
%       \draw_path_arc_axes:nnnn { 0 } { 90 }
%         { 2cm , 5mm } { 0cm , 1cm }
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \begin{function}{\draw_path_ellipse:nnn}
%   \begin{syntax}
%     \cs{draw_path_ellipse:nnn} \Arg{center} \Arg{vector1} \Arg{vector2}
%   \end{syntax}
%   Appends an ellipse at \meta{center} with axes along \meta{vector1} and
%   \meta{vector2} to the current path. A new part is started if the path
%   is already non-empty. Notice that the underlying drawing is constructed
%   from arcs with appropriate moves: the interfaces is a more efficient
%   convenience.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_ellipse:nnn
%         { 1cm , 0cm }
%         { 1.5cm , 0cm }
%         { 0cm , 1cm }
%       \draw_path_use_clear:n { stroke }
%       \draw_color:n { red }
%       \draw_path_ellipse:nnn
%         { 1cm , 0cm }
%         { 1cm , 1cm }
%         { -0.5cm , 0.5cm }
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
%
%   Note that any transformation is applied to the completed ellipse rather than
%   to the axes.
% \end{function}
%
% \begin{function}{\draw_path_circle:nn}
%   \begin{syntax}
%     \cs{draw_path_circle:nn} \Arg{center} \Arg{radius}
%   \end{syntax}
%   Appends a circle of \meta{radius} at \meta{center} to the current path. 
%   This is a shortcut for \cs{draw_path_ellipse:nnn}.
% \end{function}
%
% \begin{function}{\draw_path_rectangle:nn, \draw_path_rectangle_corners:nn}
%   \begin{syntax}
%     \cs{draw_path_rectangle:nn} \Arg{lower-left} \Arg{displacement}
%     \cs{draw_path_rectangle_corners:nn} \Arg{lower-left} \Arg{top-right}
%   \end{syntax}
%   Appends a rectangle starting at \meta{lower-left} to the current path,
%   with the size of the rectangle determined either by a \meta{displacement}
%   or the position of the \meta{top-right}.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_rectangle:nn
%         { 1cm , 0cm }
%         { 1.5cm , 1cm }
%       \draw_path_rectangle:nn
%         { 1.5cm , 0.25cm }
%         { 1.5cm , 1cm }
%       \draw_path_rectangle:nn
%         { 2cm , 0.5cm }
%         { 1.5cm , 1cm }
%       \draw_path_use_clear:n { draw }
%     \draw_end:
%   \end{demo}
%   \begin{demo}
%     \draw_begin:
%       \draw_path_rectangle_corners:nn
%         { 1cm , 0cm }
%         { 1.5cm , 1cm }
%       \draw_path_use_clear:n { draw }
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \begin{function}{\draw_path_grid:nnnn}
%   \begin{syntax}
%     \cs{draw_path_grid:nnnn} \Arg{xstep} \Arg{ystep} \Arg{lower-left} \Arg{upper-right}
%   \end{syntax}
%   Constructs a grid of \meta{xstep} and \meta{ystep} inside the rectangle
%   defined by the \meta{lower-left} and the \meta{upper-right}, and appends
%   this to the current path. The grid will be aligned such that grid lines
%   pass through the origin, which may result in \enquote{protruding} ends
%   if the start/end positions do not fully align.
%   \begin{demo}
%     \draw_begin:
%       \draw_linewidth:n { 0.8pt }
%       \draw_path_grid:nnnn
%         { 1cm } { 1cm }
%         { -3mm , -3mm }
%         { 33mm , 23mm }
%       \draw_path_use_clear:n { stroke }
%       \draw_linewidth:n { 0.4pt }
%       \draw_path_grid:nnnn
%         { 1mm } { 1mm }
%         { -1.5mm , -1.5mm }
%         { 31.5mm , 21.5mm }
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
%
%   Any transformation is applied to the finished grid.
%   \begin{demo}
%     \draw_begin:
%       \draw_transform_rotate:n { 10 }
%       \draw_path_grid:nnnn
%         { 1mm } { 2mm }
%         { 0mm , 0mm }
%         { 30mm , 30mm }
%       \draw_path_use_clear:n { stroke }
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \subsubsection{Path scope}
%
% \begin{function}{\draw_path_scope_begin:, \draw_path_scope_end:}
%   \begin{syntax}
%     \cs{draw_path_scope_begin:}
%     ...
%     \cs{draw_path_scope_end:}
%   \end{syntax}
%   Suspends (and saves) the current (partial) path, initialising a new
%   path within the scope. Path operations are written to output only when
%   used, so the scoped path is stored at the \pkg{expl3} level, not
%   in the output.
% \end{function}
%
% \subsubsection{Path operations on canvas axes}
%
% For \emph{specialist} work, a small number of functions are provided
% which work relative to the canvas axes, \emph{i.e.}~these functions
% ignore the transformation matrix.
%
% \begin{function}{\draw_path_canvas_moveto:n}
%   \begin{syntax}
%     \cs{draw_path_canvas_moveto:n} \Arg{canvas point}
%   \end{syntax}
%   Moves the reference point of the path to the \meta{canvas point}, but will
%   not join this to any previous point.
% \end{function}
%
% \begin{function}{\draw_path_canvas_lineto:n}
%   \begin{syntax}
%     \cs{draw_path_canvas_lineto:n} \Arg{canvas point}
%   \end{syntax}
%   Joins the current path to the \meta{canvas point} with a straight line.
% \end{function}
%
% \begin{function}{\draw_path_canvas_curveto:nnn}
%   \begin{syntax}
%     \cs{draw_path_canvas_curveto:nnn} \Arg{control1} \Arg{control2} \Arg{end}
%   \end{syntax}
%   Joins the current path to the \meta{end} with a curved line defined by
%   cubic Bézier points \meta{control1} and \meta{control2}. These positions
%   are given as canvas points.
% \end{function}
%
% \subsection{Bounding box}
%
% \begin{variable}{\l_draw_bb_update_bool}
%   All functions automatically update the bounding box of the image, unless
%   specified otherwise. This behavior is selectable using the
%   \cs{l_draw_bb_update_bool} boolean.
% \end{variable}
%
% \subsection{Boxes and coffins}
%
% \begin{function}{\draw_box_use:N}
%   \begin{syntax}
%     \cs{draw_box_use:N} \meta{box}
%   \end{syntax}
%   Inserts the \meta{box} into a drawing, taking account of the current
%   transformation matrix and shift, and adjusting the drawing bounding
%   box to contain the (apparent) size of the box if this is active
%   (see \cs{l_draw_bb_update_bool}).
%   \begin{demo}
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_lineto:n { 0cm , 1cm }
%       \draw_path_use_clear:n { stroke }
%       \hbox_set:Nn \l_tmpa_box
%         { This~is~text. }
%       \draw_box_use:N \l_tmpa_box
%     \draw_end:
%   \end{demo}
%   \begin{demo}
%     \draw_begin:
%       \draw_transform_matrix_absolute:nnnn { 2 } { 0 } { 1 } { 2 }
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_lineto:n { 0cm , 1cm }
%       \draw_path_use_clear:n { stroke }
%       \hbox_set:Nn \l_tmpa_box
%         { This~is~text. }
%       \draw_box_use:N \l_tmpa_box
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \begin{function}{\draw_coffin_use:Nnn}
%   \begin{syntax}
%     \cs{draw_coffin_use:N} \meta{coffin} \Arg{hpole} \Arg{vpole}
%   \end{syntax}
%   Inserts the \meta{coffin} into a drawing, taking account of the current
%   transformation matrix and shift, and adjusting the drawing bounding
%   box to contain the (apparent) size of the box if this is active
%   (see \cs{l_draw_bb_update_bool}). The alignment point of the coffin to
%   the origin is specified by the intersection of the \meta{hpole} and the
%   \meta{vpole}.
%   \begin{demo}
%     \draw_begin:
%       \draw_path_moveto:n { 0cm , 0cm }
%       \draw_path_lineto:n { 0cm , 1cm }
%       \draw_path_use_clear:n { stroke }
%       \hcoffin_set:Nn \l_tmpa_coffin
%         { This~is~text. }
%       \draw_coffin_use:Nnn \l_tmpa_coffin { hc } { vc }
%     \draw_end:
%   \end{demo}
% \end{function}
%
% \subsection{Color}
%
% \begin{function}{\draw_color:n, \draw_color_fill:n, \draw_color_stroke:n}
%   \begin{syntax}
%     \cs{draw_color:n} \Arg{color expression}
%   \end{syntax}
%   Evaluates the \meta{color expression} as described for \pkg{l3color}.
% \end{function}
%
% \subsection{Transformations}
%
% Points are normally used unchanged relative to the canvas axes. This can
% be modified by applying a transformation matrix. The canvas axes themselves
% may be adjusted using \cs{driver_draw_cm:nnnn}: note that this
% is transparent to the drawing code so is not tracked.
%
% \begin{function}
%   {\draw_transform_matrix:nnnn, \draw_transform_matrix_absolute:nnnn}
%   \begin{syntax}
%     \cs{draw_transform_matrix:nnnn}
%       \Arg{a} \Arg{b} \Arg{c} \Arg{d}
%   \end{syntax}
%   Applies the transformation matrix $[ \meta{a} \meta{b} \meta{c} \meta{d}]$.
%   The basic applies the transformation in addition to those active; the
%   |absolute| version overwrites any active transformation.
%   This assignment is local.
% \end{function}
%
% \begin{function}{\draw_transform_shift:n, \draw_transform_shift_absolute:n}
%   \begin{syntax}
%     \cs{draw_transform_shift:n} \Arg{vector}
%   \end{syntax}
%   Applies the transformation \meta{vector} to points.
%   The basic applies the vector in addition to those active; the
%   |absolute| version overwrites any active vector.
%   This assignment is local.
% \end{function}
%
% \begin{function}{\draw_transform_triangle:nnn}
%   \begin{syntax}
%     \cs{draw_transform_triangle:nnn}
%       \Arg{origin} \Arg{point1} \Arg{point2}
%   \end{syntax}
%   Applies a transformation such that the co-ordinates $(0, 0)$, $(1, 0)$
%   and $(0, 1)$ are given by the \meta{origin}, \meta{point1} and
%   \meta{point2}, respectively.
%   This assignment is local.
% \end{function}
%
% \begin{function}{\draw_transform_rotate:n}
%   \begin{syntax}
%     \cs{draw_transform_rotate:n} \Arg{angle}
%   \end{syntax}
%   Applies a rotation by the \meta{angle}, measured anti-clockwise in degrees.
%   This rotation is \emph{additional} to any prevailing transformation.
%   This assignment is local.
% \end{function}
%
% \begin{function}
%   {
%     \draw_transform_scale:n,
%     \draw_transform_xscale:n,
%     \draw_transform_yscale:n
%   }
%   \begin{syntax}
%     \cs{draw_transform_scale:n} \Arg{scale}
%   \end{syntax}
%   Applies the \meta{scale} in either $x$ or $y$ (or both).
%   This scale is \emph{added} to any prevailing transformation.
%   This assignment is local.
% \end{function}
%
% \begin{function}
%   {
%     \draw_transform_xshift:n,
%     \draw_transform_yshift:n
%   }
%   \begin{syntax}
%     \cs{draw_transform_xshift:n} \Arg{xshift}
%   \end{syntax}
%   Applies an \meta{xshift} or \meta{yshift}, as appropriate. This shift is
%   \emph{added} to any prevailing one.
%   This assignment is local.
% \end{function}
%
% \begin{function}
%   {
%     \draw_transform_xslant:n,
%     \draw_transform_yslant:n
%   }
%   \begin{syntax}
%     \cs{draw_transform_xslant:n} \Arg{slant}
%   \end{syntax}
%   Applies the \meta{slant} (a factor) in either $x$ or $y$.
%   This slant is \emph{added} to any prevailing transformation.
%   This assignment is local.
% \end{function}
%
% \begin{function}
%   {\draw_transform_matrix_invert:, \draw_transform_shift_invert:}
%   \begin{syntax}
%     \cs{draw_transform_matrix_invert:}
%   \end{syntax}
%   Inverts the current transformation matrix or shift vector, as
%   appropriate.
%   This assignment is local.
% \end{function}
%
% \begin{function}
%   {\draw_transform_matrix_reset:, \draw_transform_shift_reset:}
%   \begin{syntax}
%     \cs{draw_transform_matrix_reset:}
%   \end{syntax}
%   Resets the current transformation matrix or shift vector, as
%   appropriate.
%   This assignment is local.
% \end{function}
%
% \subsection{Layers}
%
% Drawing layers may be used to alter the way in which elements are stacked
% on top of one another. In particular, they are useful when the nature of
% an element depends on another, but where it needs to be behind it's
% \enquote{parent}. A classic example is a filled background: this needs to
% know the size of the material it is behind.
%
% All drawings feature a layer called |main|. This layer should always be
% present, and is the one which \enquote{non-layered} content is added to.
%
% \begin{function}{\draw_layer_new:n}
%   \begin{syntax}
%     \cs{draw_layer_new:n} \Arg{layer}
%   \end{syntax}
%   Creates a new \meta{layer} which can then be used in drawing. The layer
%   |main| is pre-defined.
% \end{function}
%
% \begin{function}{\draw_layer_begin:n, \draw_layer_end:}
%   \begin{syntax}
%     \cs{draw_layer_begin:n} \Arg{layer}
%     ...
%     \cs{draw_layer_end:}
%   \end{syntax}
%   Begin and end collection of material for the \meta{layer}, which should
%   previously have been created (and which cannot be |main|). Material
%   collected for the layer is available globally within the current drawing.
% \end{function}
%
% \begin{variable}{\l_draw_layers_clist}
%   The list of active layers: may be given anywhere before \cs{draw_end:}.
%   The |main| layer should always be included.
% \end{variable}
%
% \end{documentation}
%
% \begin{implementation}
%
% \section{\pkg{l3draw} implementation}
%
%    \begin{macrocode}
%<*initex|package>
%    \end{macrocode}
%
%    \begin{macrocode}
%<@@=draw>
%    \end{macrocode}
%
%    \begin{macrocode}
%<*package>
\ProvidesExplPackage{l3draw}{2020-07-17}{}
  {L3 Experimental core drawing support}
%</package>
%    \end{macrocode}
%
%    \begin{macrocode}
\RequirePackage { l3color }
%    \end{macrocode}
%
% \subsection{Internal auxiliaries}
%
% \begin{variable}{\s_@@_mark,\s_@@_stop}
%   Internal scan marks.
%    \begin{macrocode}
\scan_new:N \s_@@_mark
\scan_new:N \s_@@_stop
%    \end{macrocode}
% \end{variable}
%
% \begin{variable}{\q_@@_recursion_tail,\q_@@_recursion_stop}
%   Internal recursion quarks.
%    \begin{macrocode}
\quark_new:N \q_@@_recursion_tail
\quark_new:N \q_@@_recursion_stop
%    \end{macrocode}
% \end{variable}
%
% \begin{macro}[EXP]{\@@_if_recursion_tail_stop_do:Nn}
%   Functions to query recursion quarks.
%    \begin{macrocode}
\__kernel_quark_new_test:N \@@_if_recursion_tail_stop_do:Nn
%    \end{macrocode}
% \end{macro}
%
% Everything else is in the sub-files!
%
%    \begin{macrocode}
%</initex|package>
%    \end{macrocode}
%
% \end{implementation}
%
% \PrintIndex