% \iffalse meta-comment
%
%% File: l3draw-state.dtx
%
% Copyright (C) 2018-2025 The LaTeX 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 \LaTeX{} Project\thanks
%    {^^A
%      E-mail:
%        \href{mailto:latex-team@latex-project.org}
%          {latex-team@latex-project.org}^^A
%    }^^A
% }
%
% \date{Released 2025-06-30}
%
% \maketitle
%
% \begin{implementation}
%
% \section{\pkg{l3draw-state} implementation}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
%    \begin{macrocode}
%<@@=draw>
%    \end{macrocode}
%
% This sub-module covers more-or-less the same ideas as
% \texttt{pgfcoregraphicstate.code.tex}. At present, equivalents of the
% following are currently absent:
% \begin{itemize}
%   \item \cs{pgfsetinnerlinewidth}, \cs{pgfinnerlinewidth},
%     \cs{pgfsetinnerstrokecolor}, \cs{pgfsetinnerstrokecolor}: Likely to
%     be added on further work is done on paths/stroking.
% \end{itemize}
%
% \begin{variable}{\g_@@_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
%    \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_set_linewidth:n}
%   Set the linewidth: we need a wrapper as this has to pass to the driver
%   layer.
%    \begin{macrocode}
\cs_new_protected:Npn \draw_set_linewidth:n #1
  {
    \dim_gset:Nn \g_@@_linewidth_dim { \fp_to_dim:n {#1} }
    \@@_backend_linewidth:n \g_@@_linewidth_dim
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\draw_set_dash_pattern:nn}
% \begin{variable}{\l_@@_tmp_seq}
%   Evaluated all of the list and pass it to the driver layer.
%    \begin{macrocode}
\cs_new_protected:Npn \draw_set_dash_pattern:nn #1#2
  {
    \group_begin:
      \seq_set_from_clist:Nn \l_@@_tmp_seq {#1}
      \seq_set_map:NNn \l_@@_tmp_seq \l_@@_tmp_seq
        { \fp_to_dim:n {##1} }
      \use:e
        {
          \@@_backend_dash_pattern:nn
            { \seq_use:Nn \l_@@_tmp_seq { , } }
            { \fp_to_dim:n {#2} }
        }
    \group_end:
  }
\seq_new:N \l_@@_tmp_seq
%    \end{macrocode}
% \end{variable}
% \end{macro}
%
% \begin{macro}{\draw_set_miterlimit:n}
%   Pass through to the driver layer.
%    \begin{macrocode}
\cs_new_protected:Npn \draw_set_miterlimit:n #1
  { \exp_args:Ne \@@_backend_miterlimit:n { \fp_eval:n {#1} } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}
%   {
%     \draw_set_cap_butt:, \draw_set_cap_rectangle:, \draw_set_cap_round:,
%     \draw_set_evenodd_rule:, \draw_set_nonzero_rule:,
%     \draw_set_join_bevel:, \draw_set_join_miter:, \draw_set_join_round:
%   }
%   All straight wrappers.
%    \begin{macrocode}
\cs_new_protected:Npn \draw_set_cap_butt: { \@@_backend_cap_butt: }
\cs_new_protected:Npn \draw_set_cap_rectangle: { \@@_backend_cap_rectangle: }
\cs_new_protected:Npn \draw_set_cap_round: { \@@_backend_cap_round: }
\cs_new_protected:Npn \draw_set_evenodd_rule: { \@@_backend_evenodd_rule: }
\cs_new_protected:Npn \draw_set_nonzero_rule: { \@@_backend_nonzero_rule: }
\cs_new_protected:Npn \draw_set_join_bevel: { \@@_backend_join_bevel: }
\cs_new_protected:Npn \draw_set_join_miter: { \@@_backend_join_miter: }
\cs_new_protected:Npn \draw_set_join_round: { \@@_backend_join_round: }
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \end{implementation}
%
% \PrintIndex
