%%
%% This is file `l3backend-dvisvgm.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3backend-basics.dtx  (with options: `package,dvisvgm')
%% l3backend-color.dtx  (with options: `package,dvisvgm')
%% l3backend-box.dtx  (with options: `package,dvisvgm')
%% l3backend-draw.dtx  (with options: `package,dvisvgm')
%% l3backend-graphics.dtx  (with options: `package,dvisvgm')
%% l3backend-pdf.dtx  (with options: `package,dvisvgm')
%% 
%% Copyright (C) 1990-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:
%% 
%%    https://www.latex-project.org/lppl.txt
%% 
%% This file is part of the "l3backend bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%% 
%% File: l3backend-basics.dtx
\ProvidesExplFile
  {l3backend-dvisvgm.def}{2020-05-05}{}
  {L3 backend support: dvisvgm}
\cs_new_eq:NN \__kernel_backend_literal:e \tex_special:D
\cs_new_protected:Npn \__kernel_backend_literal:n #1
  { \__kernel_backend_literal:e { \exp_not:n {#1} } }
\cs_generate_variant:Nn \__kernel_backend_literal:n { x }
\cs_new_protected:Npn \__kernel_backend_literal_svg:n #1
  { \__kernel_backend_literal:n { dvisvgm:raw~ #1 { ?nl } } }
\cs_generate_variant:Nn \__kernel_backend_literal_svg:n { x }
\cs_new_protected:Npn \__kernel_backend_scope_begin:
  { \__kernel_backend_literal_svg:n { <g> } }
\cs_new_protected:Npn \__kernel_backend_scope_end:
  { \__kernel_backend_literal_svg:n { </g> } }
\cs_new_protected:Npn \__kernel_backend_scope_begin:n #1
  { \__kernel_backend_literal_svg:n { <g~ #1 > } }
\cs_generate_variant:Nn \__kernel_backend_scope_begin:n { x }
%% File: l3backend-color.dtx
\cs_new_protected:Npn \__color_backend_pickup:N #1 { }
\AtBeginDocument
  {
    \cs_if_exist:cT { ver@color.sty }
      {
        \cs_set_protected:Npn \__color_backend_pickup:N #1
          {
            \exp_args:NV \tl_if_head_is_space:nTF \current@color
              {
                \tl_set:Nx #1
                   {
                     spot ~
                     \exp_after:wN \use:n \current@color \c_space_tl 1
                   }
              }
              {
                \exp_last_unbraced:Nx \__color_backend_pickup:w
                  { \current@color } \q_stop #1
              }
          }
        \cs_new_protected:Npn \__color_backend_pickup:w #1 ~ #2 \q_stop #3
          { \tl_set:Nn #3 { #1 ~ #2 } }
      }
  }
\cs_new_protected:Npn \__color_backend_cmyk:nnnn #1#2#3#4
  {
    \__color_backend_select:x
      {
        cmyk~
        \fp_eval:n {#1} ~ \fp_eval:n {#2} ~
        \fp_eval:n {#3} ~ \fp_eval:n {#4}
      }
  }
\cs_new_protected:Npn \__color_backend_gray:n #1
  { \__color_backend_select:x { gray~ \fp_eval:n {#1} } }
\cs_new_protected:Npn \__color_backend_rgb:nnn #1#2#3
  {
    \__color_backend_select:x
      { rgb~ \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} }
  }
\cs_new_protected:Npn \__color_backend_spot:nn #1#2
  { \__color_backend_select:n { #1 } }
\cs_new_protected:Npn \__color_backend_select:n #1
  {
    \__kernel_backend_literal:n { color~push~ #1 }
    \group_insert_after:N \__color_backend_reset:
  }
\cs_generate_variant:Nn \__color_backend_select:n { x }
\cs_new_protected:Npn \__color_backend_reset:
  { \__kernel_backend_literal:n { color~pop } }
%% File: l3backend-box.dtx
\cs_new_protected:Npn \__box_backend_clip:N #1
  {
    \int_gincr:N \g__box_clip_path_int
    \__kernel_backend_literal_svg:x
      { < clipPath~id = " l3cp \int_use:N \g__box_clip_path_int " > }
    \__kernel_backend_literal_svg:x
      {
        <
          path ~ d =
            "
              M ~ 0 ~
                  \dim_to_decimal:n { -\box_dp:N #1 } ~
              L ~ \dim_to_decimal:n { \box_wd:N #1 } ~
                  \dim_to_decimal:n { -\box_dp:N #1 } ~
              L ~ \dim_to_decimal:n { \box_wd:N #1 }  ~
                  \dim_to_decimal:n { \box_ht:N #1 + \box_dp:N #1 } ~
              L ~ 0 ~
                  \dim_to_decimal:n { \box_ht:N #1 + \box_dp:N #1 } ~
              Z
            "
        />
      }
    \__kernel_backend_literal_svg:n
      { < /clipPath > }
    \__kernel_backend_scope_begin:n
      {
        transform =
          "
            translate ( { ?x } , { ?y } ) ~
            scale ( 1 , -1 )
          "
      }
    \__kernel_backend_scope_begin:x
      {
        clip-path =
          "url ( \c_hash_str l3cp \int_use:N \g__box_clip_path_int ) "
      }
    \__kernel_backend_scope_begin:n
      {
        transform =
          "
            scale ( -1 , 1 ) ~
            translate ( { ?x } , { ?y } ) ~
            scale ( -1 , -1 )
          "
      }
    \box_use:N #1
    \__kernel_backend_scope_end:
    \__kernel_backend_scope_end:
    \__kernel_backend_scope_end:
  }
\int_new:N \g__box_clip_path_int
\cs_new_protected:Npn \__box_backend_rotate:Nn #1#2
  {
    \__kernel_backend_scope_begin:x
      {
        transform =
          "
            rotate
            ( \fp_eval:n { round ( -(#2) , 5 ) } , ~ { ?x } , ~ { ?y } )
          "
      }
    \box_use:N #1
    \__kernel_backend_scope_end:
  }
\cs_new_protected:Npn \__box_backend_scale:Nnn #1#2#3
  {
    \__kernel_backend_scope_begin:x
      {
        transform =
          "
            translate ( { ?x } , { ?y } ) ~
            scale
              (
                \fp_eval:n { round ( -#2 , 5 ) } ,
                \fp_eval:n { round ( -#3 , 5 ) }
              ) ~
            translate ( { ?x } , { ?y } ) ~
            scale ( -1 )
          "
      }
    \hbox_overlap_right:n { \box_use:N #1 }
    \__kernel_backend_scope_end:
  }
%% File: l3backend-draw.dtx
\cs_new_eq:NN \__draw_backend_literal:n \__kernel_backend_literal_svg:n
\cs_generate_variant:Nn \__draw_backend_literal:n { x }
\cs_new_protected:Npn \__draw_backend_begin:
  {
    \__draw_backend_scope_begin:
    \__draw_backend_scope:n { transform="translate({?x},{?y})~scale(1,-1)" }
  }
\cs_new_protected:Npn \__draw_backend_end:
  { \__draw_backend_scope_end: }
\cs_new_protected:Npn \__draw_backend_scope_begin:
  {
    \int_set_eq:NN
      \l__draw_draw_scope_int
      \g__draw_draw_scope_int
    \group_begin:
      \int_gzero:N \g__draw_draw_scope_int
  }
\cs_new_protected:Npn \__draw_backend_scope_end:
  {
      \prg_replicate:nn
        { \g__draw_draw_scope_int }
        { \__draw_backend_literal:n { </g> } }
    \group_end:
    \int_gset_eq:NN
      \g__draw_draw_scope_int
      \l__draw_draw_scope_int
  }
\cs_new_protected:Npn \__draw_backend_scope:n #1
  {
    \__draw_backend_literal:n { <g~ #1 > }
    \int_gincr:N \g__draw_draw_scope_int
  }
\cs_generate_variant:Nn \__draw_backend_scope:n { x }
\int_new:N \g__draw_draw_scope_int
\int_new:N \l__draw_draw_scope_int
\cs_new_protected:Npn \__draw_backend_moveto:nn #1#2
  {
    \__draw_backend_add_to_path:n
      { M ~ \dim_to_decimal:n {#1} ~ \dim_to_decimal:n {#2} }
  }
\cs_new_protected:Npn \__draw_backend_lineto:nn #1#2
  {
    \__draw_backend_add_to_path:n
      { L ~ \dim_to_decimal:n {#1} ~ \dim_to_decimal:n {#2} }
  }
\cs_new_protected:Npn \__draw_backend_rectangle:nnnn #1#2#3#4
  {
    \__draw_backend_add_to_path:n
      {
        M ~ \dim_to_decimal:n {#1} ~ \dim_to_decimal:n {#2}
        h ~ \dim_to_decimal:n {#3} ~
        v ~ \dim_to_decimal:n {#4} ~
        h ~ \dim_to_decimal:n { -#3 } ~
        Z
      }
  }
\cs_new_protected:Npn \__draw_backend_curveto:nnnnnn #1#2#3#4#5#6
  {
    \__draw_backend_add_to_path:n
      {
        C ~
        \dim_to_decimal:n {#1} ~ \dim_to_decimal:n {#2} ~
        \dim_to_decimal:n {#3} ~ \dim_to_decimal:n {#4} ~
        \dim_to_decimal:n {#5} ~ \dim_to_decimal:n {#6}
      }
  }
\cs_new_protected:Npn \__draw_backend_add_to_path:n #1
  {
    \tl_gset:Nx \g__draw_draw_path_tl
      {
        \g__draw_draw_path_tl
        \tl_if_empty:NF \g__draw_draw_path_tl { \c_space_tl }
        #1
      }
  }
\tl_new:N \g__draw_draw_path_tl
\cs_new_protected:Npn \__draw_backend_evenodd_rule:
  { \__draw_backend_scope:n { fill-rule="evenodd" } }
\cs_new_protected:Npn \__draw_backend_nonzero_rule:
  { \__draw_backend_scope:n { fill-rule="nonzero" } }
\cs_new_protected:Npn \__draw_backend_closepath:
  { \__draw_backend_add_to_path:n { Z } }
\cs_new_protected:Npn \__draw_backend_path:n #1
  {
    \bool_if:NTF \g__draw_draw_clip_bool
      {
        \int_gincr:N \g__draw_clip_path_int
        \__draw_backend_literal:x
          {
            < clipPath~id = " l3cp \int_use:N \g__draw_clip_path_int " >
              { ?nl }
            <path~d=" \g__draw_draw_path_tl "/> { ?nl }
            < /clipPath > { ? nl }
            <
              use~xlink:href =
                "\c_hash_str l3path \int_use:N \g__draw_path_int " ~
                #1
            />
          }
        \__draw_backend_scope:x
          {
            clip-path =
              "url( \c_hash_str l3cp \int_use:N \g__draw_clip_path_int)"
          }
      }
      {
        \__draw_backend_literal:x
          { <path ~ d=" \g__draw_draw_path_tl " ~ #1 /> }
      }
    \tl_gclear:N \g__draw_draw_path_tl
    \bool_gset_false:N \g__draw_draw_clip_bool
  }
\int_new:N \g__draw_path_int
\cs_new_protected:Npn \__draw_backend_stroke:
  { \__draw_backend_path:n { style="fill:none" } }
\cs_new_protected:Npn \__draw_backend_closestroke:
  {
    \__draw_backend_closepath:
    \__draw_backend_stroke:
  }
\cs_new_protected:Npn \__draw_backend_fill:
  { \__draw_backend_path:n { style="stroke:none" } }
\cs_new_protected:Npn \__draw_backend_fillstroke:
  { \__draw_backend_path:n { } }
\cs_new_protected:Npn \__draw_backend_clip:
  { \bool_gset_true:N \g__draw_draw_clip_bool }
\bool_new:N \g__draw_draw_clip_bool
\cs_new_protected:Npn \__draw_backend_discardpath:
  {
    \bool_if:NT \g__draw_draw_clip_bool
      {
        \int_gincr:N \g__draw_clip_path_int
        \__draw_backend_literal:x
          {
            < clipPath~id = " l3cp \int_use:N \g__draw_clip_path_int " >
              { ?nl }
            <path~d=" \g__draw_draw_path_tl "/> { ?nl }
            < /clipPath >
          }
        \__draw_backend_scope:x
          {
            clip-path =
              "url( \c_hash_str l3cp \int_use:N \g__draw_clip_path_int)"
          }
      }
    \tl_gclear:N \g__draw_draw_path_tl
    \bool_gset_false:N \g__draw_draw_clip_bool
  }
\cs_new_protected:Npn \__draw_backend_dash_pattern:nn #1#2
  {
    \use:x
      {
        \__draw_backend_dash_aux:nn
          { \clist_map_function:nn {#1} \__draw_backend_dash:n }
          { \dim_to_decimal:n {#2} }
      }
  }
\cs_new:Npn \__draw_backend_dash:n #1
  { , \dim_to_decimal_in_bp:n {#1} }
\cs_new_protected:Npn \__draw_backend_dash_aux:nn #1#2
  {
    \__draw_backend_scope:x
      {
        stroke-dasharray =
          "
            \tl_if_empty:oTF { \use_none:n #1 }
              { none }
              { \use_none:n #1 }
          " ~
          stroke-offset=" #2 "
      }
  }
\cs_new_protected:Npn \__draw_backend_linewidth:n #1
  { \__draw_backend_scope:x { stroke-width=" \dim_to_decimal:n {#1} " } }
\cs_new_protected:Npn \__draw_backend_miterlimit:n #1
  { \__draw_backend_scope:x { stroke-miterlimit=" \fp_eval:n {#1} " } }
\cs_new_protected:Npn \__draw_backend_cap_butt:
  { \__draw_backend_scope:n { stroke-linecap="butt" } }
\cs_new_protected:Npn \__draw_backend_cap_round:
  { \__draw_backend_scope:n { stroke-linecap="round" } }
\cs_new_protected:Npn \__draw_backend_cap_rectangle:
  { \__draw_backend_scope:n { stroke-linecap="square" } }
\cs_new_protected:Npn \__draw_backend_join_miter:
  { \__draw_backend_scope:n { stroke-linejoin="miter" } }
\cs_new_protected:Npn \__draw_backend_join_round:
  { \__draw_backend_scope:n { stroke-linejoin="round" } }
\cs_new_protected:Npn \__draw_backend_join_bevel:
  { \__draw_backend_scope:n { stroke-linejoin="bevel" } }
\cs_new_protected:Npn \__draw_backend_color_fill_cmyk:nnnn #1#2#3#4
  {
    \use:x
      {
        \__draw_backend_color_fill:nnn
          { \fp_eval:n { -100 * ( (#1) * ( 1 - (#4) ) - 1 ) } }
          { \fp_eval:n { -100 * ( (#2) * ( 1 - (#4) ) + #4 - 1 ) } }
          { \fp_eval:n { -100 * ( (#3) * ( 1 - (#4) ) + #4 - 1 ) } }
      }
  }
\cs_new_protected:Npn \__draw_backend_color_stroke_cmyk:nnnn #1#2#3#4
  {
    \__draw_backend_select:x
      {
        cmyk~
        \fp_eval:n {#1} ~ \fp_eval:n {#2} ~
        \fp_eval:n {#3} ~ \fp_eval:n {#4}
      }
  }
\cs_new_protected:Npn \__draw_backend_color_fill_gray:n #1
  {
    \use:x
      {
        \__draw_backend_color_gray_aux:n
          { \fp_eval:n { 100 * (#1) } }
      }
  }
\cs_new_protected:Npn \__draw_backend_color_gray_aux:n #1
  { \__draw_backend_color_fill:nnn {#1} {#1} {#1} }
\cs_new_protected:Npn \__draw_backend_color_stroke_gray:n #1
  { \__draw_backend_select:x { gray~ \fp_eval:n {#1} } }
\cs_new_protected:Npn \__draw_backend_color_fill_rgb:nnn #1#2#3
  {
    \use:x
      {
        \__draw_backend_color_fill:nnn
          { \fp_eval:n { 100 * (#1) } }
          { \fp_eval:n { 100 * (#2) } }
          { \fp_eval:n { 100 * (#3) } }
      }
  }
\cs_new_protected:Npn \__draw_backend_color_fill:nnn #1#2#3
  {
    \__draw_backend_scope:x
      {
        fill =
         "
           rgb
             (
               #1 \c_percent_str ,
               #2 \c_percent_str ,
               #3 \c_percent_str
             )
         "
      }
  }
\cs_new_protected:Npn \__draw_backend_color_stroke_rgb:nnn #1#2#3
  {
    \__draw_backend_select:x
      { rgb~ \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} }
  }
\cs_new_protected:Npn \__draw_backend_cm:nnnn #1#2#3#4
  {
    \__draw_backend_scope:n
      {
       transform =
         "
           matrix
             (
               \fp_eval:n {#1} , \fp_eval:n {#2} ,
               \fp_eval:n {#3} , \fp_eval:n {#4} ,
               0pt , 0pt
             )
         "
      }
  }
\cs_new_protected:Npn \__draw_backend_box_use:Nnnnn #1#2#3#4#5#6#7
  {
    \__kernel_backend_scope_begin:
    \__draw_backend_cm:nnnn {#2} {#3} {#4} {#5}
    \__kernel_backend_literal_svg:n
      {
        < g~
            stroke="none"~
            transform="scale(-1,1)~translate({?x},{?y})~scale(-1,-1)"
        >
      }
    \box_set_wd:Nn #1 { 0pt }
    \box_set_ht:Nn #1 { 0pt }
    \box_set_dp:Nn #1 { 0pt }
    \box_use:N #1
    \__kernel_backend_literal_svg:n { </g> }
    \__kernel_backend_scope_end:
  }
%% File: l3backend-graphics.dtx
\AtBeginDocument
  { \cs_new_eq:NN \__graphics_backend_getbb_eps:n \graphics_read_bb:n }
\cs_new_protected:Npn \__graphics_backend_getbb_jpg:n #1
  {
    \int_zero:N \l_graphics_page_int
    \tl_clear:N \l_graphics_pagebox_tl
    \graphics_extract_bb:n {#1}
  }
\cs_new_eq:NN \__graphics_backend_getbb_png:n \__graphics_backend_getbb_jpg:n
\cs_new_protected:Npn \__graphics_backend_getbb_pdf:n #1
  {
    \tl_clear:N \l_graphics_decodearray_tl
    \bool_set_false:N \l_graphics_interpolate_bool
    \graphics_extract_bb:n {#1}
  }
\cs_new_protected:Npn \__graphics_backend_include_eps:n #1
  { __graphics_backend_include:nn { PSfile } {#1} }
\cs_new_protected:Npn \__graphics_backend_include_pdf:n #1
  { __graphics_backend_include:nn { pdffile } {#1} }
\cs_new_protected:Npn \__graphics_backend_include:nn #1#2
  {
    \__kernel_backend_literal:x
      {
        #1 = #2 \c_space_tl
        llx = \dim_to_decimal_in_bp:n \l_graphics_llx_dim \c_space_tl
        lly = \dim_to_decimal_in_bp:n \l_graphics_lly_dim \c_space_tl
        urx = \dim_to_decimal_in_bp:n \l_graphics_urx_dim \c_space_tl
        ury = \dim_to_decimal_in_bp:n \l_graphics_ury_dim
      }
  }
\cs_new_protected:Npn \__graphics_backend_include_png:n #1
  {
     \__kernel_backend_literal:x
       {
         dvisvgm:img~
         \dim_to_decimal:n { \l_graphics_ury_dim } ~
         \dim_to_decimal:n { \l_graphics_ury_dim } ~
         \__graphics_backend_include_bitmap_quote:w #1 " #1 " \q_stop
       }
  }
\cs_new_eq:NN \__graphics_backend_include_jpg:n \__graphics_backend_include_png:n
\cs_new:Npn \__graphics_backend_include_bitmap_quote:w #1 " #2 " #3 \q_stop
  { " #2 " }
%% File: l3backend-pdf.dtx
\box_new:N \l__pdf_internal_box
\cs_new_protected:Npn \__pdf_backend_catalog_gput:nn #1#2 { }
\cs_new_protected:Npn \__pdf_backend_info_gput:nn #1#2 { }
\cs_new_protected:Npn \__pdf_backend_object_new:nn #1#2 { }
\cs_new:Npn \__pdf_backend_object_ref:n #1 { }
\cs_new_protected:Npn \__pdf_backend_object_write:nn #1#2 { }
\cs_new_protected:Npn \__pdf_backend_object_write:nx #1#2 { }
\cs_new_protected:Npn \__pdf_backend_object_now:nn #1#2 { }
\cs_new_protected:Npn \__pdf_backend_object_now:nx #1#2 { }
\cs_new:Npn \__pdf_backend_object_last: { }
\cs_new:Npn \__pdf_backend_pageobject_ref:n #1 { }
\cs_new_protected:Npn \__pdf_backend_compresslevel:n #1 { }
\cs_new_protected:Npn \__pdf_backend_compress_objects:n #1 { }
\cs_new_protected:Npn \__pdf_backend_version_major_gset:n #1 { }
\cs_new_protected:Npn \__pdf_backend_version_minor_gset:n #1 { }
\cs_new:Npn \__pdf_backend_version_major: { -1 }
\cs_new:Npn \__pdf_backend_version_minor: { -1 }
\cs_new_protected:Npn \__pdf_backend_bdc:nn #1#2 { }
\cs_new_protected:Npn \__pdf_backend_emc: { }
%% 
%%
%% End of file `l3backend-dvisvgm.def'.
