  


<!DOCTYPE html>
<html>
  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
    <meta charset='utf-8'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>jSignature/src/plugins/jSignature.CompressorSVG.js at master · willowsystems/jSignature · GitHub</title>
    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
    <link rel="apple-touch-icon-precomposed" sizes="57x57" href="apple-touch-icon-114.png" />
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114.png" />
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-144.png" />
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144.png" />
    <meta name="msapplication-TileImage" content="/windows-tile.png">
    <meta name="msapplication-TileColor" content="#ffffff">

    
    
    <link rel="icon" type="image/x-icon" href="/favicon.ico" />

    <meta content="authenticity_token" name="csrf-param" />
<meta content="QS4K04MSTYS0twqHWh6+N7wx9eUH7QXCDM+WTcMzlUQ=" name="csrf-token" />

    <link href="https://a248.e.akamai.net/assets.github.com/assets/github-5a0c784c2462ad6bfaa5f91bb7706d91af73bb55.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-67227d297542c9d59a0b3ae5b0002e22d50174af.css" media="screen" rel="stylesheet" type="text/css" />
    


    <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-971f385ccf2fcbf04f87e9ffca82e855620eb233.js" type="text/javascript"></script>
    <script src="https://a248.e.akamai.net/assets.github.com/assets/github-44260b1fca293cb0de2ed4a53426536a1af440c9.js" type="text/javascript"></script>
    

        <link rel='permalink' href='/willowsystems/jSignature/blob/d7c33c8c172147461a53b34b788defb297174680/src/plugins/jSignature.CompressorSVG.js'>
    <meta property="og:title" content="jSignature"/>
    <meta property="og:type" content="githubog:gitrepository"/>
    <meta property="og:url" content="https://github.com/willowsystems/jSignature"/>
    <meta property="og:image" content="https://secure.gravatar.com/avatar/658a737be82067f54b05c1f7de440def?s=420&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"/>
    <meta property="og:site_name" content="GitHub"/>
    <meta property="og:description" content="jQuery plugin - draw signature in browser. Contribute to jSignature development by creating an account on GitHub."/>

    <meta name="description" content="jQuery plugin - draw signature in browser. Contribute to jSignature development by creating an account on GitHub." />

  <link href="https://github.com/willowsystems/jSignature/commits/master.atom" rel="alternate" title="Recent Commits to jSignature:master" type="application/atom+xml" />

  </head>


  <body class="logged_out page-blob windows vis-public fork env-production ">
    <div id="wrapper">

      

      

      


        <div class="header header-logged-out">
          <div class="container clearfix">

            <a class="header-logo-wordmark" href="https://github.com/">
              <img alt="GitHub" class="github-logo-4x" height="30" src="https://a248.e.akamai.net/assets.github.com/images/modules/header/logov7@4x.png?1338956357" />
              <img alt="GitHub" class="github-logo-4x-hover" height="30" src="https://a248.e.akamai.net/assets.github.com/images/modules/header/logov7@4x-hover.png?1338956357" />
            </a>

              
<ul class="top-nav">
    <li class="explore"><a href="https://github.com/explore">Explore GitHub</a></li>
  <li class="search"><a href="https://github.com/search">Search</a></li>
  <li class="features"><a href="https://github.com/features">Features</a></li>
    <li class="blog"><a href="https://github.com/blog">Blog</a></li>
</ul>


            <div class="header-actions">
                <a class="button primary classy" href="https://github.com/signup">Sign up for free</a>
              <a class="button classy" href="https://github.com/login?return_to=%2Fwillowsystems%2FjSignature%2Fblob%2Fmaster%2Fsrc%2Fplugins%2FjSignature.CompressorSVG.js">Sign in</a>
            </div>

          </div>
        </div>


      

      


            <div class="site hfeed" itemscope itemtype="http://schema.org/WebPage">
      <div class="hentry">
        
        <div class="pagehead repohead instapaper_ignore readability-menu">
          <div class="container">
            <div class="title-actions-bar">
              


                  <ul class="pagehead-actions">


          <li>
            <span class="star-button"><a href="/login?return_to=%2Fwillowsystems%2FjSignature" class="minibutton js-toggler-target entice tooltipped leftwards" title="You must be signed in to use this feature" rel="nofollow"><span class="mini-icon mini-icon-star"></span>Star</a><a class="social-count js-social-count" href="/willowsystems/jSignature/stargazers">107</a></span>
          </li>
          <li>
            <a href="/login?return_to=%2Fwillowsystems%2FjSignature" class="minibutton js-toggler-target fork-button entice tooltipped leftwards"  title="You must be signed in to fork a repository" rel="nofollow"><span class="mini-icon mini-icon-fork"></span>Fork</a><a href="/willowsystems/jSignature/network" class="social-count">28</a>
          </li>
    </ul>

              <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
                <span class="repo-label"><span>public</span></span>
                <span class="mega-icon mega-icon-public-repo"></span>
                <span class="author vcard">
                  <a href="/willowsystems" class="url fn" itemprop="url" rel="author">
                  <span itemprop="title">willowsystems</span>
                  </a></span> /
                <strong><a href="/willowsystems/jSignature" class="js-current-repository">jSignature</a></strong>
                  <span class="fork-flag">
                    <span class="text">forked from <a href="/brinley/jSignature">brinley/jSignature</a></span>
                  </span>
              </h1>
            </div>

            

  <ul class="tabs">
    <li><a href="/willowsystems/jSignature" class="selected" highlight="repo_sourcerepo_downloadsrepo_commitsrepo_tagsrepo_branches">Code</a></li>
    <li><a href="/willowsystems/jSignature/network" highlight="repo_network">Network</a></li>
    <li><a href="/willowsystems/jSignature/pulls" highlight="repo_pulls">Pull Requests <span class='counter'>2</span></a></li>

      <li><a href="/willowsystems/jSignature/issues" highlight="repo_issues">Issues <span class='counter'>8</span></a></li>

      <li><a href="/willowsystems/jSignature/wiki" highlight="repo_wiki">Wiki</a></li>


    <li><a href="/willowsystems/jSignature/graphs" highlight="repo_graphsrepo_contributors">Graphs</a></li>


  </ul>
  
<div class="tabnav">

  <span class="tabnav-right">
    <ul class="tabnav-tabs">
          <li><a href="/willowsystems/jSignature/tags" class="tabnav-tab" highlight="repo_tags">Tags <span class="counter blank">0</span></a></li>
    </ul>
    
  </span>

  <div class="tabnav-widget scope">


    <div class="context-menu-container js-menu-container js-context-menu">
      <a href="#"
         class="minibutton bigger switcher js-menu-target js-commitish-button btn-branch repo-tree"
         data-hotkey="w"
         data-ref="master">
         <span><em class="mini-icon mini-icon-branch"></em><i>branch:</i> master</span>
      </a>

      <div class="context-pane commitish-context js-menu-content">
        <a href="#" class="close js-menu-close"><span class="mini-icon mini-icon-remove-close"></span></a>
        <div class="context-title">Switch branches/tags</div>
        <div class="context-body pane-selector commitish-selector js-navigation-container">
          <div class="filterbar">
            <input type="text" id="context-commitish-filter-field" class="js-navigation-enable js-filterable-field js-ref-filter-field" placeholder="Filter branches/tags">
            <ul class="tabs">
              <li><a href="#" data-filter="branches" class="selected">Branches</a></li>
                <li><a href="#" data-filter="tags">Tags</a></li>
            </ul>
          </div>

          <div class="js-filter-tab js-filter-branches">
            <div data-filterable-for="context-commitish-filter-field" data-filterable-type=substring>
                <div class="commitish-item branch-commitish selector-item js-navigation-item js-navigation-target ">
                  <span class="mini-icon mini-icon-confirm"></span>
                  <h4>
                      <a href="/willowsystems/jSignature/blob/another_noconflict/src/plugins/jSignature.CompressorSVG.js" class="js-navigation-open" data-name="another_noconflict" rel="nofollow">another_noconflict</a>
                  </h4>
                </div>
                <div class="commitish-item branch-commitish selector-item js-navigation-item js-navigation-target ">
                  <span class="mini-icon mini-icon-confirm"></span>
                  <h4>
                      <a href="/willowsystems/jSignature/blob/gh-pages/src/plugins/jSignature.CompressorSVG.js" class="js-navigation-open" data-name="gh-pages" rel="nofollow">gh-pages</a>
                  </h4>
                </div>
                <div class="commitish-item branch-commitish selector-item js-navigation-item js-navigation-target selected">
                  <span class="mini-icon mini-icon-confirm"></span>
                  <h4>
                      <a href="/willowsystems/jSignature/blob/master/src/plugins/jSignature.CompressorSVG.js" class="js-navigation-open" data-name="master" rel="nofollow">master</a>
                  </h4>
                </div>
                <div class="commitish-item branch-commitish selector-item js-navigation-item js-navigation-target ">
                  <span class="mini-icon mini-icon-confirm"></span>
                  <h4>
                      <a href="/willowsystems/jSignature/blob/stable/src/plugins/jSignature.CompressorSVG.js" class="js-navigation-open" data-name="stable" rel="nofollow">stable</a>
                  </h4>
                </div>
            </div>
            <div class="no-results">Nothing to show</div>


          </div>

            <div class="js-filter-tab js-filter-tags filter-tab-empty" style="display:none">
              <div data-filterable-for="context-commitish-filter-field" data-filterable-type=substring>
              </div>
              <div class="no-results">Nothing to show</div>
            </div>

        </div>
      </div><!-- /.commitish-context-context -->
    </div>
  </div> <!-- /.scope -->

  <ul class="tabnav-tabs">
    <li><a href="/willowsystems/jSignature" class="selected tabnav-tab" highlight="repo_source">Files</a></li>
    <li><a href="/willowsystems/jSignature/commits/master" class="tabnav-tab" highlight="repo_commits">Commits</a></li>
    <li><a href="/willowsystems/jSignature/branches" class="tabnav-tab" highlight="repo_branches" rel="nofollow">Branches <span class="counter ">4</span></a></li>
  </ul>

</div>

  
  
  


            
          </div>
        </div><!-- /.repohead -->

        <div id="js-repo-pjax-container" class="container context-loader-container" data-pjax-container>
          


<!-- blob contrib key: blob_contributors:v21:5f4a67682aba93cc4d5576841340c311 -->
<!-- blob contrib frag key: views10/v8/blob_contributors:v21:5f4a67682aba93cc4d5576841340c311 -->

<div id="slider">


    <div class="frame-meta">

      <p title="This is a placeholder element" class="js-history-link-replace hidden"></p>
      <div class="breadcrumb">
        <span class='bold'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/willowsystems/jSignature" class="js-slide-to" data-direction="back" itemscope="url"><span itemprop="title">jSignature</span></a></span></span> / <span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/willowsystems/jSignature/tree/master/src" class="js-slide-to" data-direction="back" itemscope="url"><span itemprop="title">src</span></a></span> / <span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/willowsystems/jSignature/tree/master/src/plugins" class="js-slide-to" data-direction="back" itemscope="url"><span itemprop="title">plugins</span></a></span> / <strong class="final-path">jSignature.CompressorSVG.js</strong> <span class="js-zeroclipboard zeroclipboard-button" data-clipboard-text="src/plugins/jSignature.CompressorSVG.js" data-copied-hint="copied!" title="copy to clipboard"><span class="mini-icon mini-icon-clipboard"></span></span>
      </div>

      <a href="/willowsystems/jSignature/find/master" class="js-slide-to" data-hotkey="t" style="display:none">Show File Finder</a>

        <div class="commit commit-loader file-history-tease js-deferred-content" data-url="/willowsystems/jSignature/contributors/master/src/plugins/jSignature.CompressorSVG.js">
          Fetching contributors…

          <div class="participation">
            <p class="loader-loading"><img alt="Octocat-spinner-32-eaf2f5" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32-EAF2F5.gif?1338956357" width="16" /></p>
            <p class="loader-error">Cannot retrieve contributors at this time</p>
          </div>
        </div>

    </div><!-- ./.frame-meta -->

    <div class="frames">
      <div class="frame" data-permalink-url="/willowsystems/jSignature/blob/d7c33c8c172147461a53b34b788defb297174680/src/plugins/jSignature.CompressorSVG.js" data-title="jSignature/src/plugins/jSignature.CompressorSVG.js at master · willowsystems/jSignature · GitHub" data-type="blob">

        <div id="files" class="bubble">
          <div class="file">
            <div class="meta">
              <div class="info">
                <span class="icon"><b class="mini-icon mini-icon-text-file"></b></span>
                <span class="mode" title="File Mode">file</span>
                  <span>498 lines (446 sloc)</span>
                <span>17.414 kb</span>
              </div>
              <ul class="button-group actions">
                  <li>
                      <a class="grouped-button minibutton bigger lighter js-entice" href=""
                         data-entice="You must be signed in and on a branch to make or propose changes">Edit</a>
                  </li>
                <li><a href="/willowsystems/jSignature/raw/master/src/plugins/jSignature.CompressorSVG.js" class="minibutton grouped-button bigger lighter" id="raw-url">Raw</a></li>
                  <li><a href="/willowsystems/jSignature/blame/master/src/plugins/jSignature.CompressorSVG.js" class="minibutton grouped-button bigger lighter">Blame</a></li>
                <li><a href="/willowsystems/jSignature/commits/master/src/plugins/jSignature.CompressorSVG.js" class="minibutton grouped-button bigger lighter" rel="nofollow">History</a></li>
              </ul>
            </div>
                <div class="data type-javascript">
      <table cellpadding="0" cellspacing="0" class="lines">
        <tr>
          <td>
            <pre class="line_numbers"><span id="L1" rel="#L1">1</span>
<span id="L2" rel="#L2">2</span>
<span id="L3" rel="#L3">3</span>
<span id="L4" rel="#L4">4</span>
<span id="L5" rel="#L5">5</span>
<span id="L6" rel="#L6">6</span>
<span id="L7" rel="#L7">7</span>
<span id="L8" rel="#L8">8</span>
<span id="L9" rel="#L9">9</span>
<span id="L10" rel="#L10">10</span>
<span id="L11" rel="#L11">11</span>
<span id="L12" rel="#L12">12</span>
<span id="L13" rel="#L13">13</span>
<span id="L14" rel="#L14">14</span>
<span id="L15" rel="#L15">15</span>
<span id="L16" rel="#L16">16</span>
<span id="L17" rel="#L17">17</span>
<span id="L18" rel="#L18">18</span>
<span id="L19" rel="#L19">19</span>
<span id="L20" rel="#L20">20</span>
<span id="L21" rel="#L21">21</span>
<span id="L22" rel="#L22">22</span>
<span id="L23" rel="#L23">23</span>
<span id="L24" rel="#L24">24</span>
<span id="L25" rel="#L25">25</span>
<span id="L26" rel="#L26">26</span>
<span id="L27" rel="#L27">27</span>
<span id="L28" rel="#L28">28</span>
<span id="L29" rel="#L29">29</span>
<span id="L30" rel="#L30">30</span>
<span id="L31" rel="#L31">31</span>
<span id="L32" rel="#L32">32</span>
<span id="L33" rel="#L33">33</span>
<span id="L34" rel="#L34">34</span>
<span id="L35" rel="#L35">35</span>
<span id="L36" rel="#L36">36</span>
<span id="L37" rel="#L37">37</span>
<span id="L38" rel="#L38">38</span>
<span id="L39" rel="#L39">39</span>
<span id="L40" rel="#L40">40</span>
<span id="L41" rel="#L41">41</span>
<span id="L42" rel="#L42">42</span>
<span id="L43" rel="#L43">43</span>
<span id="L44" rel="#L44">44</span>
<span id="L45" rel="#L45">45</span>
<span id="L46" rel="#L46">46</span>
<span id="L47" rel="#L47">47</span>
<span id="L48" rel="#L48">48</span>
<span id="L49" rel="#L49">49</span>
<span id="L50" rel="#L50">50</span>
<span id="L51" rel="#L51">51</span>
<span id="L52" rel="#L52">52</span>
<span id="L53" rel="#L53">53</span>
<span id="L54" rel="#L54">54</span>
<span id="L55" rel="#L55">55</span>
<span id="L56" rel="#L56">56</span>
<span id="L57" rel="#L57">57</span>
<span id="L58" rel="#L58">58</span>
<span id="L59" rel="#L59">59</span>
<span id="L60" rel="#L60">60</span>
<span id="L61" rel="#L61">61</span>
<span id="L62" rel="#L62">62</span>
<span id="L63" rel="#L63">63</span>
<span id="L64" rel="#L64">64</span>
<span id="L65" rel="#L65">65</span>
<span id="L66" rel="#L66">66</span>
<span id="L67" rel="#L67">67</span>
<span id="L68" rel="#L68">68</span>
<span id="L69" rel="#L69">69</span>
<span id="L70" rel="#L70">70</span>
<span id="L71" rel="#L71">71</span>
<span id="L72" rel="#L72">72</span>
<span id="L73" rel="#L73">73</span>
<span id="L74" rel="#L74">74</span>
<span id="L75" rel="#L75">75</span>
<span id="L76" rel="#L76">76</span>
<span id="L77" rel="#L77">77</span>
<span id="L78" rel="#L78">78</span>
<span id="L79" rel="#L79">79</span>
<span id="L80" rel="#L80">80</span>
<span id="L81" rel="#L81">81</span>
<span id="L82" rel="#L82">82</span>
<span id="L83" rel="#L83">83</span>
<span id="L84" rel="#L84">84</span>
<span id="L85" rel="#L85">85</span>
<span id="L86" rel="#L86">86</span>
<span id="L87" rel="#L87">87</span>
<span id="L88" rel="#L88">88</span>
<span id="L89" rel="#L89">89</span>
<span id="L90" rel="#L90">90</span>
<span id="L91" rel="#L91">91</span>
<span id="L92" rel="#L92">92</span>
<span id="L93" rel="#L93">93</span>
<span id="L94" rel="#L94">94</span>
<span id="L95" rel="#L95">95</span>
<span id="L96" rel="#L96">96</span>
<span id="L97" rel="#L97">97</span>
<span id="L98" rel="#L98">98</span>
<span id="L99" rel="#L99">99</span>
<span id="L100" rel="#L100">100</span>
<span id="L101" rel="#L101">101</span>
<span id="L102" rel="#L102">102</span>
<span id="L103" rel="#L103">103</span>
<span id="L104" rel="#L104">104</span>
<span id="L105" rel="#L105">105</span>
<span id="L106" rel="#L106">106</span>
<span id="L107" rel="#L107">107</span>
<span id="L108" rel="#L108">108</span>
<span id="L109" rel="#L109">109</span>
<span id="L110" rel="#L110">110</span>
<span id="L111" rel="#L111">111</span>
<span id="L112" rel="#L112">112</span>
<span id="L113" rel="#L113">113</span>
<span id="L114" rel="#L114">114</span>
<span id="L115" rel="#L115">115</span>
<span id="L116" rel="#L116">116</span>
<span id="L117" rel="#L117">117</span>
<span id="L118" rel="#L118">118</span>
<span id="L119" rel="#L119">119</span>
<span id="L120" rel="#L120">120</span>
<span id="L121" rel="#L121">121</span>
<span id="L122" rel="#L122">122</span>
<span id="L123" rel="#L123">123</span>
<span id="L124" rel="#L124">124</span>
<span id="L125" rel="#L125">125</span>
<span id="L126" rel="#L126">126</span>
<span id="L127" rel="#L127">127</span>
<span id="L128" rel="#L128">128</span>
<span id="L129" rel="#L129">129</span>
<span id="L130" rel="#L130">130</span>
<span id="L131" rel="#L131">131</span>
<span id="L132" rel="#L132">132</span>
<span id="L133" rel="#L133">133</span>
<span id="L134" rel="#L134">134</span>
<span id="L135" rel="#L135">135</span>
<span id="L136" rel="#L136">136</span>
<span id="L137" rel="#L137">137</span>
<span id="L138" rel="#L138">138</span>
<span id="L139" rel="#L139">139</span>
<span id="L140" rel="#L140">140</span>
<span id="L141" rel="#L141">141</span>
<span id="L142" rel="#L142">142</span>
<span id="L143" rel="#L143">143</span>
<span id="L144" rel="#L144">144</span>
<span id="L145" rel="#L145">145</span>
<span id="L146" rel="#L146">146</span>
<span id="L147" rel="#L147">147</span>
<span id="L148" rel="#L148">148</span>
<span id="L149" rel="#L149">149</span>
<span id="L150" rel="#L150">150</span>
<span id="L151" rel="#L151">151</span>
<span id="L152" rel="#L152">152</span>
<span id="L153" rel="#L153">153</span>
<span id="L154" rel="#L154">154</span>
<span id="L155" rel="#L155">155</span>
<span id="L156" rel="#L156">156</span>
<span id="L157" rel="#L157">157</span>
<span id="L158" rel="#L158">158</span>
<span id="L159" rel="#L159">159</span>
<span id="L160" rel="#L160">160</span>
<span id="L161" rel="#L161">161</span>
<span id="L162" rel="#L162">162</span>
<span id="L163" rel="#L163">163</span>
<span id="L164" rel="#L164">164</span>
<span id="L165" rel="#L165">165</span>
<span id="L166" rel="#L166">166</span>
<span id="L167" rel="#L167">167</span>
<span id="L168" rel="#L168">168</span>
<span id="L169" rel="#L169">169</span>
<span id="L170" rel="#L170">170</span>
<span id="L171" rel="#L171">171</span>
<span id="L172" rel="#L172">172</span>
<span id="L173" rel="#L173">173</span>
<span id="L174" rel="#L174">174</span>
<span id="L175" rel="#L175">175</span>
<span id="L176" rel="#L176">176</span>
<span id="L177" rel="#L177">177</span>
<span id="L178" rel="#L178">178</span>
<span id="L179" rel="#L179">179</span>
<span id="L180" rel="#L180">180</span>
<span id="L181" rel="#L181">181</span>
<span id="L182" rel="#L182">182</span>
<span id="L183" rel="#L183">183</span>
<span id="L184" rel="#L184">184</span>
<span id="L185" rel="#L185">185</span>
<span id="L186" rel="#L186">186</span>
<span id="L187" rel="#L187">187</span>
<span id="L188" rel="#L188">188</span>
<span id="L189" rel="#L189">189</span>
<span id="L190" rel="#L190">190</span>
<span id="L191" rel="#L191">191</span>
<span id="L192" rel="#L192">192</span>
<span id="L193" rel="#L193">193</span>
<span id="L194" rel="#L194">194</span>
<span id="L195" rel="#L195">195</span>
<span id="L196" rel="#L196">196</span>
<span id="L197" rel="#L197">197</span>
<span id="L198" rel="#L198">198</span>
<span id="L199" rel="#L199">199</span>
<span id="L200" rel="#L200">200</span>
<span id="L201" rel="#L201">201</span>
<span id="L202" rel="#L202">202</span>
<span id="L203" rel="#L203">203</span>
<span id="L204" rel="#L204">204</span>
<span id="L205" rel="#L205">205</span>
<span id="L206" rel="#L206">206</span>
<span id="L207" rel="#L207">207</span>
<span id="L208" rel="#L208">208</span>
<span id="L209" rel="#L209">209</span>
<span id="L210" rel="#L210">210</span>
<span id="L211" rel="#L211">211</span>
<span id="L212" rel="#L212">212</span>
<span id="L213" rel="#L213">213</span>
<span id="L214" rel="#L214">214</span>
<span id="L215" rel="#L215">215</span>
<span id="L216" rel="#L216">216</span>
<span id="L217" rel="#L217">217</span>
<span id="L218" rel="#L218">218</span>
<span id="L219" rel="#L219">219</span>
<span id="L220" rel="#L220">220</span>
<span id="L221" rel="#L221">221</span>
<span id="L222" rel="#L222">222</span>
<span id="L223" rel="#L223">223</span>
<span id="L224" rel="#L224">224</span>
<span id="L225" rel="#L225">225</span>
<span id="L226" rel="#L226">226</span>
<span id="L227" rel="#L227">227</span>
<span id="L228" rel="#L228">228</span>
<span id="L229" rel="#L229">229</span>
<span id="L230" rel="#L230">230</span>
<span id="L231" rel="#L231">231</span>
<span id="L232" rel="#L232">232</span>
<span id="L233" rel="#L233">233</span>
<span id="L234" rel="#L234">234</span>
<span id="L235" rel="#L235">235</span>
<span id="L236" rel="#L236">236</span>
<span id="L237" rel="#L237">237</span>
<span id="L238" rel="#L238">238</span>
<span id="L239" rel="#L239">239</span>
<span id="L240" rel="#L240">240</span>
<span id="L241" rel="#L241">241</span>
<span id="L242" rel="#L242">242</span>
<span id="L243" rel="#L243">243</span>
<span id="L244" rel="#L244">244</span>
<span id="L245" rel="#L245">245</span>
<span id="L246" rel="#L246">246</span>
<span id="L247" rel="#L247">247</span>
<span id="L248" rel="#L248">248</span>
<span id="L249" rel="#L249">249</span>
<span id="L250" rel="#L250">250</span>
<span id="L251" rel="#L251">251</span>
<span id="L252" rel="#L252">252</span>
<span id="L253" rel="#L253">253</span>
<span id="L254" rel="#L254">254</span>
<span id="L255" rel="#L255">255</span>
<span id="L256" rel="#L256">256</span>
<span id="L257" rel="#L257">257</span>
<span id="L258" rel="#L258">258</span>
<span id="L259" rel="#L259">259</span>
<span id="L260" rel="#L260">260</span>
<span id="L261" rel="#L261">261</span>
<span id="L262" rel="#L262">262</span>
<span id="L263" rel="#L263">263</span>
<span id="L264" rel="#L264">264</span>
<span id="L265" rel="#L265">265</span>
<span id="L266" rel="#L266">266</span>
<span id="L267" rel="#L267">267</span>
<span id="L268" rel="#L268">268</span>
<span id="L269" rel="#L269">269</span>
<span id="L270" rel="#L270">270</span>
<span id="L271" rel="#L271">271</span>
<span id="L272" rel="#L272">272</span>
<span id="L273" rel="#L273">273</span>
<span id="L274" rel="#L274">274</span>
<span id="L275" rel="#L275">275</span>
<span id="L276" rel="#L276">276</span>
<span id="L277" rel="#L277">277</span>
<span id="L278" rel="#L278">278</span>
<span id="L279" rel="#L279">279</span>
<span id="L280" rel="#L280">280</span>
<span id="L281" rel="#L281">281</span>
<span id="L282" rel="#L282">282</span>
<span id="L283" rel="#L283">283</span>
<span id="L284" rel="#L284">284</span>
<span id="L285" rel="#L285">285</span>
<span id="L286" rel="#L286">286</span>
<span id="L287" rel="#L287">287</span>
<span id="L288" rel="#L288">288</span>
<span id="L289" rel="#L289">289</span>
<span id="L290" rel="#L290">290</span>
<span id="L291" rel="#L291">291</span>
<span id="L292" rel="#L292">292</span>
<span id="L293" rel="#L293">293</span>
<span id="L294" rel="#L294">294</span>
<span id="L295" rel="#L295">295</span>
<span id="L296" rel="#L296">296</span>
<span id="L297" rel="#L297">297</span>
<span id="L298" rel="#L298">298</span>
<span id="L299" rel="#L299">299</span>
<span id="L300" rel="#L300">300</span>
<span id="L301" rel="#L301">301</span>
<span id="L302" rel="#L302">302</span>
<span id="L303" rel="#L303">303</span>
<span id="L304" rel="#L304">304</span>
<span id="L305" rel="#L305">305</span>
<span id="L306" rel="#L306">306</span>
<span id="L307" rel="#L307">307</span>
<span id="L308" rel="#L308">308</span>
<span id="L309" rel="#L309">309</span>
<span id="L310" rel="#L310">310</span>
<span id="L311" rel="#L311">311</span>
<span id="L312" rel="#L312">312</span>
<span id="L313" rel="#L313">313</span>
<span id="L314" rel="#L314">314</span>
<span id="L315" rel="#L315">315</span>
<span id="L316" rel="#L316">316</span>
<span id="L317" rel="#L317">317</span>
<span id="L318" rel="#L318">318</span>
<span id="L319" rel="#L319">319</span>
<span id="L320" rel="#L320">320</span>
<span id="L321" rel="#L321">321</span>
<span id="L322" rel="#L322">322</span>
<span id="L323" rel="#L323">323</span>
<span id="L324" rel="#L324">324</span>
<span id="L325" rel="#L325">325</span>
<span id="L326" rel="#L326">326</span>
<span id="L327" rel="#L327">327</span>
<span id="L328" rel="#L328">328</span>
<span id="L329" rel="#L329">329</span>
<span id="L330" rel="#L330">330</span>
<span id="L331" rel="#L331">331</span>
<span id="L332" rel="#L332">332</span>
<span id="L333" rel="#L333">333</span>
<span id="L334" rel="#L334">334</span>
<span id="L335" rel="#L335">335</span>
<span id="L336" rel="#L336">336</span>
<span id="L337" rel="#L337">337</span>
<span id="L338" rel="#L338">338</span>
<span id="L339" rel="#L339">339</span>
<span id="L340" rel="#L340">340</span>
<span id="L341" rel="#L341">341</span>
<span id="L342" rel="#L342">342</span>
<span id="L343" rel="#L343">343</span>
<span id="L344" rel="#L344">344</span>
<span id="L345" rel="#L345">345</span>
<span id="L346" rel="#L346">346</span>
<span id="L347" rel="#L347">347</span>
<span id="L348" rel="#L348">348</span>
<span id="L349" rel="#L349">349</span>
<span id="L350" rel="#L350">350</span>
<span id="L351" rel="#L351">351</span>
<span id="L352" rel="#L352">352</span>
<span id="L353" rel="#L353">353</span>
<span id="L354" rel="#L354">354</span>
<span id="L355" rel="#L355">355</span>
<span id="L356" rel="#L356">356</span>
<span id="L357" rel="#L357">357</span>
<span id="L358" rel="#L358">358</span>
<span id="L359" rel="#L359">359</span>
<span id="L360" rel="#L360">360</span>
<span id="L361" rel="#L361">361</span>
<span id="L362" rel="#L362">362</span>
<span id="L363" rel="#L363">363</span>
<span id="L364" rel="#L364">364</span>
<span id="L365" rel="#L365">365</span>
<span id="L366" rel="#L366">366</span>
<span id="L367" rel="#L367">367</span>
<span id="L368" rel="#L368">368</span>
<span id="L369" rel="#L369">369</span>
<span id="L370" rel="#L370">370</span>
<span id="L371" rel="#L371">371</span>
<span id="L372" rel="#L372">372</span>
<span id="L373" rel="#L373">373</span>
<span id="L374" rel="#L374">374</span>
<span id="L375" rel="#L375">375</span>
<span id="L376" rel="#L376">376</span>
<span id="L377" rel="#L377">377</span>
<span id="L378" rel="#L378">378</span>
<span id="L379" rel="#L379">379</span>
<span id="L380" rel="#L380">380</span>
<span id="L381" rel="#L381">381</span>
<span id="L382" rel="#L382">382</span>
<span id="L383" rel="#L383">383</span>
<span id="L384" rel="#L384">384</span>
<span id="L385" rel="#L385">385</span>
<span id="L386" rel="#L386">386</span>
<span id="L387" rel="#L387">387</span>
<span id="L388" rel="#L388">388</span>
<span id="L389" rel="#L389">389</span>
<span id="L390" rel="#L390">390</span>
<span id="L391" rel="#L391">391</span>
<span id="L392" rel="#L392">392</span>
<span id="L393" rel="#L393">393</span>
<span id="L394" rel="#L394">394</span>
<span id="L395" rel="#L395">395</span>
<span id="L396" rel="#L396">396</span>
<span id="L397" rel="#L397">397</span>
<span id="L398" rel="#L398">398</span>
<span id="L399" rel="#L399">399</span>
<span id="L400" rel="#L400">400</span>
<span id="L401" rel="#L401">401</span>
<span id="L402" rel="#L402">402</span>
<span id="L403" rel="#L403">403</span>
<span id="L404" rel="#L404">404</span>
<span id="L405" rel="#L405">405</span>
<span id="L406" rel="#L406">406</span>
<span id="L407" rel="#L407">407</span>
<span id="L408" rel="#L408">408</span>
<span id="L409" rel="#L409">409</span>
<span id="L410" rel="#L410">410</span>
<span id="L411" rel="#L411">411</span>
<span id="L412" rel="#L412">412</span>
<span id="L413" rel="#L413">413</span>
<span id="L414" rel="#L414">414</span>
<span id="L415" rel="#L415">415</span>
<span id="L416" rel="#L416">416</span>
<span id="L417" rel="#L417">417</span>
<span id="L418" rel="#L418">418</span>
<span id="L419" rel="#L419">419</span>
<span id="L420" rel="#L420">420</span>
<span id="L421" rel="#L421">421</span>
<span id="L422" rel="#L422">422</span>
<span id="L423" rel="#L423">423</span>
<span id="L424" rel="#L424">424</span>
<span id="L425" rel="#L425">425</span>
<span id="L426" rel="#L426">426</span>
<span id="L427" rel="#L427">427</span>
<span id="L428" rel="#L428">428</span>
<span id="L429" rel="#L429">429</span>
<span id="L430" rel="#L430">430</span>
<span id="L431" rel="#L431">431</span>
<span id="L432" rel="#L432">432</span>
<span id="L433" rel="#L433">433</span>
<span id="L434" rel="#L434">434</span>
<span id="L435" rel="#L435">435</span>
<span id="L436" rel="#L436">436</span>
<span id="L437" rel="#L437">437</span>
<span id="L438" rel="#L438">438</span>
<span id="L439" rel="#L439">439</span>
<span id="L440" rel="#L440">440</span>
<span id="L441" rel="#L441">441</span>
<span id="L442" rel="#L442">442</span>
<span id="L443" rel="#L443">443</span>
<span id="L444" rel="#L444">444</span>
<span id="L445" rel="#L445">445</span>
<span id="L446" rel="#L446">446</span>
<span id="L447" rel="#L447">447</span>
<span id="L448" rel="#L448">448</span>
<span id="L449" rel="#L449">449</span>
<span id="L450" rel="#L450">450</span>
<span id="L451" rel="#L451">451</span>
<span id="L452" rel="#L452">452</span>
<span id="L453" rel="#L453">453</span>
<span id="L454" rel="#L454">454</span>
<span id="L455" rel="#L455">455</span>
<span id="L456" rel="#L456">456</span>
<span id="L457" rel="#L457">457</span>
<span id="L458" rel="#L458">458</span>
<span id="L459" rel="#L459">459</span>
<span id="L460" rel="#L460">460</span>
<span id="L461" rel="#L461">461</span>
<span id="L462" rel="#L462">462</span>
<span id="L463" rel="#L463">463</span>
<span id="L464" rel="#L464">464</span>
<span id="L465" rel="#L465">465</span>
<span id="L466" rel="#L466">466</span>
<span id="L467" rel="#L467">467</span>
<span id="L468" rel="#L468">468</span>
<span id="L469" rel="#L469">469</span>
<span id="L470" rel="#L470">470</span>
<span id="L471" rel="#L471">471</span>
<span id="L472" rel="#L472">472</span>
<span id="L473" rel="#L473">473</span>
<span id="L474" rel="#L474">474</span>
<span id="L475" rel="#L475">475</span>
<span id="L476" rel="#L476">476</span>
<span id="L477" rel="#L477">477</span>
<span id="L478" rel="#L478">478</span>
<span id="L479" rel="#L479">479</span>
<span id="L480" rel="#L480">480</span>
<span id="L481" rel="#L481">481</span>
<span id="L482" rel="#L482">482</span>
<span id="L483" rel="#L483">483</span>
<span id="L484" rel="#L484">484</span>
<span id="L485" rel="#L485">485</span>
<span id="L486" rel="#L486">486</span>
<span id="L487" rel="#L487">487</span>
<span id="L488" rel="#L488">488</span>
<span id="L489" rel="#L489">489</span>
<span id="L490" rel="#L490">490</span>
<span id="L491" rel="#L491">491</span>
<span id="L492" rel="#L492">492</span>
<span id="L493" rel="#L493">493</span>
<span id="L494" rel="#L494">494</span>
<span id="L495" rel="#L495">495</span>
<span id="L496" rel="#L496">496</span>
<span id="L497" rel="#L497">497</span>
<span id="L498" rel="#L498">498</span>
</pre>
          </td>
          <td width="100%">
                <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/** @license</span></div><div class='line' id='LC2'><span class="cm">jSignature v2 SVG export plugin.</span></div><div class='line' id='LC3'><br/></div><div class='line' id='LC4'><span class="cm">*/</span></div><div class='line' id='LC5'><span class="cm">/**</span></div><div class='line' id='LC6'><span class="cm">Copyright (c) 2012 Willow Systems Corp http://willow-systems.com</span></div><div class='line' id='LC7'><span class="cm">MIT License &lt;http://www.opensource.org/licenses/mit-license.php&gt;</span></div><div class='line' id='LC8'><span class="cm">*/</span></div><div class='line' id='LC9'><br/></div><div class='line' id='LC10'><span class="p">;(</span><span class="kd">function</span><span class="p">(){</span></div><div class='line' id='LC11'>	<span class="s1">&#39;use strict&#39;</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="cm">/** @preserve</span></div><div class='line' id='LC14'><span class="cm">Simplify.js BSD </span></div><div class='line' id='LC15'><span class="cm">(c) 2012, Vladimir Agafonkin</span></div><div class='line' id='LC16'><span class="cm">mourner.github.com/simplify-js</span></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'><span class="cm">*/</span></div><div class='line' id='LC19'>	<span class="p">;(</span><span class="kd">function</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span><span class="nx">b</span><span class="p">){</span><span class="kd">function</span> <span class="nx">c</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span><span class="nx">b</span><span class="p">){</span><span class="kd">var</span> <span class="nx">c</span><span class="o">=</span><span class="nx">a</span><span class="p">.</span><span class="nx">x</span><span class="o">-</span><span class="nx">b</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span><span class="nx">d</span><span class="o">=</span><span class="nx">a</span><span class="p">.</span><span class="nx">y</span><span class="o">-</span><span class="nx">b</span><span class="p">.</span><span class="nx">y</span><span class="p">;</span><span class="k">return</span> <span class="nx">c</span><span class="o">*</span><span class="nx">c</span><span class="o">+</span><span class="nx">d</span><span class="o">*</span><span class="nx">d</span><span class="p">}</span><span class="kd">function</span> <span class="nx">d</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span><span class="nx">b</span><span class="p">,</span><span class="nx">c</span><span class="p">){</span><span class="kd">var</span> <span class="nx">d</span><span class="o">=</span><span class="nx">b</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span><span class="nx">e</span><span class="o">=</span><span class="nx">b</span><span class="p">.</span><span class="nx">y</span><span class="p">,</span><span class="nx">f</span><span class="o">=</span><span class="nx">c</span><span class="p">.</span><span class="nx">x</span><span class="o">-</span><span class="nx">d</span><span class="p">,</span><span class="nx">g</span><span class="o">=</span><span class="nx">c</span><span class="p">.</span><span class="nx">y</span><span class="o">-</span><span class="nx">e</span><span class="p">,</span><span class="nx">h</span><span class="p">;</span><span class="k">if</span><span class="p">(</span><span class="nx">f</span><span class="o">!==</span><span class="mi">0</span><span class="o">||</span><span class="nx">g</span><span class="o">!==</span><span class="mi">0</span><span class="p">)</span><span class="nx">h</span><span class="o">=</span><span class="p">((</span><span class="nx">a</span><span class="p">.</span><span class="nx">x</span><span class="o">-</span><span class="nx">d</span><span class="p">)</span><span class="o">*</span><span class="nx">f</span><span class="o">+</span><span class="p">(</span><span class="nx">a</span><span class="p">.</span><span class="nx">y</span><span class="o">-</span><span class="nx">e</span><span class="p">)</span><span class="o">*</span><span class="nx">g</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="nx">f</span><span class="o">*</span><span class="nx">f</span><span class="o">+</span><span class="nx">g</span><span class="o">*</span><span class="nx">g</span><span class="p">),</span><span class="nx">h</span><span class="o">&gt;</span><span class="mi">1</span><span class="o">?</span><span class="p">(</span><span class="nx">d</span><span class="o">=</span><span class="nx">c</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span><span class="nx">e</span><span class="o">=</span><span class="nx">c</span><span class="p">.</span><span class="nx">y</span><span class="p">)</span><span class="o">:</span><span class="nx">h</span><span class="o">&gt;</span><span class="mi">0</span><span class="o">&amp;&amp;</span><span class="p">(</span><span class="nx">d</span><span class="o">+=</span><span class="nx">f</span><span class="o">*</span><span class="nx">h</span><span class="p">,</span><span class="nx">e</span><span class="o">+=</span><span class="nx">g</span><span class="o">*</span><span class="nx">h</span><span class="p">);</span><span class="k">return</span> <span class="nx">f</span><span class="o">=</span><span class="nx">a</span><span class="p">.</span><span class="nx">x</span><span class="o">-</span><span class="nx">d</span><span class="p">,</span><span class="nx">g</span><span class="o">=</span><span class="nx">a</span><span class="p">.</span><span class="nx">y</span><span class="o">-</span><span class="nx">e</span><span class="p">,</span><span class="nx">f</span><span class="o">*</span><span class="nx">f</span><span class="o">+</span><span class="nx">g</span><span class="o">*</span><span class="nx">g</span><span class="p">}</span><span class="kd">function</span> <span class="nx">e</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span><span class="nx">b</span><span class="p">){</span><span class="kd">var</span> <span class="nx">d</span><span class="p">,</span><span class="nx">e</span><span class="o">=</span><span class="nx">a</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span><span class="nx">f</span><span class="p">,</span><span class="nx">g</span><span class="o">=</span><span class="nx">a</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="nx">h</span><span class="o">=</span><span class="p">[</span><span class="nx">g</span><span class="p">];</span><span class="k">for</span><span class="p">(</span><span class="nx">d</span><span class="o">=</span><span class="mi">1</span><span class="p">;</span><span class="nx">d</span><span class="o">&lt;</span><span class="nx">e</span><span class="p">;</span><span class="nx">d</span><span class="o">++</span><span class="p">)</span><span class="nx">f</span><span class="o">=</span><span class="nx">a</span><span class="p">[</span><span class="nx">d</span><span class="p">],</span><span class="nx">c</span><span class="p">(</span><span class="nx">f</span><span class="p">,</span><span class="nx">g</span><span class="p">)</span><span class="o">&gt;</span><span class="nx">b</span><span class="o">&amp;&amp;</span><span class="p">(</span><span class="nx">h</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">f</span><span class="p">),</span><span class="nx">g</span><span class="o">=</span><span class="nx">f</span><span class="p">);</span><span class="k">return</span> <span class="nx">g</span><span class="o">!==</span><span class="nx">f</span><span class="o">&amp;&amp;</span><span class="nx">h</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">f</span><span class="p">),</span><span class="nx">h</span><span class="p">}</span><span class="kd">function</span> <span class="nx">f</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span><span class="nx">c</span><span class="p">){</span><span class="kd">var</span> <span class="nx">e</span><span class="o">=</span><span class="nx">a</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span><span class="nx">f</span><span class="o">=</span><span class="k">typeof</span> <span class="nx">Uint8Array</span><span class="o">!=</span><span class="nx">b</span><span class="o">+</span><span class="s2">&quot;&quot;</span><span class="o">?</span><span class="nx">Uint8Array</span><span class="o">:</span><span class="nb">Array</span><span class="p">,</span><span class="nx">g</span><span class="o">=</span><span class="k">new</span> <span class="nx">f</span><span class="p">(</span><span class="nx">e</span><span class="p">),</span><span class="nx">h</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span><span class="nx">i</span><span class="o">=</span><span class="nx">e</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="nx">j</span><span class="p">,</span><span class="nx">k</span><span class="p">,</span><span class="nx">l</span><span class="p">,</span><span class="nx">m</span><span class="p">,</span><span class="nx">n</span><span class="o">=</span><span class="p">[],</span><span class="nx">o</span><span class="o">=</span><span class="p">[],</span><span class="nx">p</span><span class="o">=</span><span class="p">[];</span><span class="nx">g</span><span class="p">[</span><span class="nx">h</span><span class="p">]</span><span class="o">=</span><span class="nx">g</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span><span class="o">=</span><span class="mi">1</span><span class="p">;</span><span class="k">while</span><span class="p">(</span><span class="nx">i</span><span class="p">){</span><span class="nx">k</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="k">for</span><span class="p">(</span><span class="nx">j</span><span class="o">=</span><span class="nx">h</span><span class="o">+</span><span class="mi">1</span><span class="p">;</span><span class="nx">j</span><span class="o">&lt;</span><span class="nx">i</span><span class="p">;</span><span class="nx">j</span><span class="o">++</span><span class="p">)</span><span class="nx">l</span><span class="o">=</span><span class="nx">d</span><span class="p">(</span><span class="nx">a</span><span class="p">[</span><span class="nx">j</span><span class="p">],</span><span class="nx">a</span><span class="p">[</span><span class="nx">h</span><span class="p">],</span><span class="nx">a</span><span class="p">[</span><span class="nx">i</span><span class="p">]),</span><span class="nx">l</span><span class="o">&gt;</span><span class="nx">k</span><span class="o">&amp;&amp;</span><span class="p">(</span><span class="nx">m</span><span class="o">=</span><span class="nx">j</span><span class="p">,</span><span class="nx">k</span><span class="o">=</span><span class="nx">l</span><span class="p">);</span><span class="nx">k</span><span class="o">&gt;</span><span class="nx">c</span><span class="o">&amp;&amp;</span><span class="p">(</span><span class="nx">g</span><span class="p">[</span><span class="nx">m</span><span class="p">]</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span><span class="nx">n</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">h</span><span class="p">),</span><span class="nx">o</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">m</span><span class="p">),</span><span class="nx">n</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">m</span><span class="p">),</span><span class="nx">o</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">i</span><span class="p">)),</span><span class="nx">h</span><span class="o">=</span><span class="nx">n</span><span class="p">.</span><span class="nx">pop</span><span class="p">(),</span><span class="nx">i</span><span class="o">=</span><span class="nx">o</span><span class="p">.</span><span class="nx">pop</span><span class="p">()}</span><span class="k">for</span><span class="p">(</span><span class="nx">j</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="nx">j</span><span class="o">&lt;</span><span class="nx">e</span><span class="p">;</span><span class="nx">j</span><span class="o">++</span><span class="p">)</span><span class="nx">g</span><span class="p">[</span><span class="nx">j</span><span class="p">]</span><span class="o">&amp;&amp;</span><span class="nx">p</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">a</span><span class="p">[</span><span class="nx">j</span><span class="p">]);</span><span class="k">return</span> <span class="nx">p</span><span class="p">}</span><span class="s2">&quot;use strict&quot;</span><span class="p">;</span><span class="kd">var</span> <span class="nx">g</span><span class="o">=</span><span class="k">typeof</span> <span class="nx">exports</span><span class="o">!=</span><span class="nx">b</span><span class="o">+</span><span class="s2">&quot;&quot;</span><span class="o">?</span><span class="nx">exports</span><span class="o">:</span><span class="nx">a</span><span class="p">;</span><span class="nx">g</span><span class="p">.</span><span class="nx">simplify</span><span class="o">=</span><span class="kd">function</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span><span class="nx">c</span><span class="p">,</span><span class="nx">d</span><span class="p">){</span><span class="kd">var</span> <span class="nx">g</span><span class="o">=</span><span class="nx">c</span><span class="o">!==</span><span class="nx">b</span><span class="o">?</span><span class="nx">c</span><span class="o">*</span><span class="nx">c</span><span class="o">:</span><span class="mi">1</span><span class="p">;</span><span class="k">return</span> <span class="nx">d</span><span class="o">||</span><span class="p">(</span><span class="nx">a</span><span class="o">=</span><span class="nx">e</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span><span class="nx">g</span><span class="p">)),</span><span class="nx">a</span><span class="o">=</span><span class="nx">f</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span><span class="nx">g</span><span class="p">),</span><span class="nx">a</span><span class="p">}})(</span><span class="nb">window</span><span class="p">);</span></div><div class='line' id='LC20'><br/></div><div class='line' id='LC21'><br/></div><div class='line' id='LC22'>	<span class="cm">/**</span></div><div class='line' id='LC23'><span class="cm">	Vector class. Allows us to simplify representation and manipulation of coordinate-pair</span></div><div class='line' id='LC24'><span class="cm">	representing shift against (0, 0)</span></div><div class='line' id='LC25'><br/></div><div class='line' id='LC26'><span class="cm">	@public</span></div><div class='line' id='LC27'><span class="cm">	@class</span></div><div class='line' id='LC28'><span class="cm">	@param</span></div><div class='line' id='LC29'><span class="cm">	@returns {Type}</span></div><div class='line' id='LC30'><span class="cm">	*/</span></div><div class='line' id='LC31'>	<span class="kd">function</span> <span class="nx">Vector</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span><span class="nx">y</span><span class="p">){</span></div><div class='line' id='LC32'>		<span class="k">this</span><span class="p">.</span><span class="nx">x</span> <span class="o">=</span> <span class="nx">x</span></div><div class='line' id='LC33'>		<span class="k">this</span><span class="p">.</span><span class="nx">y</span> <span class="o">=</span> <span class="nx">y</span></div><div class='line' id='LC34'>		<span class="k">this</span><span class="p">.</span><span class="nx">reverse</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span></div><div class='line' id='LC35'>			<span class="k">return</span> <span class="k">new</span> <span class="k">this</span><span class="p">.</span><span class="nx">constructor</span><span class="p">(</span> </div><div class='line' id='LC36'>				<span class="k">this</span><span class="p">.</span><span class="nx">x</span> <span class="o">*</span> <span class="o">-</span><span class="mi">1</span></div><div class='line' id='LC37'>				<span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">y</span> <span class="o">*</span> <span class="o">-</span><span class="mi">1</span></div><div class='line' id='LC38'>			<span class="p">)</span></div><div class='line' id='LC39'>		<span class="p">}</span></div><div class='line' id='LC40'>		<span class="k">this</span><span class="p">.</span><span class="nx">_length</span> <span class="o">=</span> <span class="kc">null</span></div><div class='line' id='LC41'>		<span class="k">this</span><span class="p">.</span><span class="nx">getLength</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span></div><div class='line' id='LC42'>			<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_length</span><span class="p">){</span></div><div class='line' id='LC43'>				<span class="k">this</span><span class="p">.</span><span class="nx">_length</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">sqrt</span><span class="p">(</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">pow</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">pow</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">y</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="p">)</span></div><div class='line' id='LC44'>			<span class="p">}</span></div><div class='line' id='LC45'>			<span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">_length</span></div><div class='line' id='LC46'>		<span class="p">}</span></div><div class='line' id='LC47'><br/></div><div class='line' id='LC48'>		<span class="kd">var</span> <span class="nx">polarity</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">e</span><span class="p">){</span></div><div class='line' id='LC49'>			<span class="k">return</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">round</span><span class="p">(</span><span class="nx">e</span> <span class="o">/</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">abs</span><span class="p">(</span><span class="nx">e</span><span class="p">))</span></div><div class='line' id='LC50'>		<span class="p">}</span></div><div class='line' id='LC51'>		<span class="k">this</span><span class="p">.</span><span class="nx">resizeTo</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">length</span><span class="p">){</span></div><div class='line' id='LC52'>			<span class="c1">// proportionally changes x,y such that the hypotenuse (vector length) is = new length</span></div><div class='line' id='LC53'>			<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">x</span> <span class="o">===</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">y</span> <span class="o">===</span> <span class="mi">0</span><span class="p">){</span></div><div class='line' id='LC54'>				<span class="k">this</span><span class="p">.</span><span class="nx">_length</span> <span class="o">=</span> <span class="mi">0</span></div><div class='line' id='LC55'>			<span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">x</span> <span class="o">===</span> <span class="mi">0</span><span class="p">){</span></div><div class='line' id='LC56'>				<span class="k">this</span><span class="p">.</span><span class="nx">_length</span> <span class="o">=</span> <span class="nx">length</span></div><div class='line' id='LC57'>				<span class="k">this</span><span class="p">.</span><span class="nx">y</span> <span class="o">=</span> <span class="nx">length</span> <span class="o">*</span> <span class="nx">polarity</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">y</span><span class="p">)</span></div><div class='line' id='LC58'>			<span class="p">}</span> <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">y</span> <span class="o">===</span> <span class="mi">0</span><span class="p">){</span></div><div class='line' id='LC59'>				<span class="k">this</span><span class="p">.</span><span class="nx">_length</span> <span class="o">=</span> <span class="nx">length</span></div><div class='line' id='LC60'>				<span class="k">this</span><span class="p">.</span><span class="nx">x</span> <span class="o">=</span> <span class="nx">length</span> <span class="o">*</span> <span class="nx">polarity</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">x</span><span class="p">)</span></div><div class='line' id='LC61'>			<span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC62'>				<span class="kd">var</span> <span class="nx">proportion</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">abs</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">y</span> <span class="o">/</span> <span class="k">this</span><span class="p">.</span><span class="nx">x</span><span class="p">)</span></div><div class='line' id='LC63'>					<span class="p">,</span> <span class="nx">x</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">sqrt</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">pow</span><span class="p">(</span><span class="nx">length</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">pow</span><span class="p">(</span><span class="nx">proportion</span><span class="p">,</span> <span class="mi">2</span><span class="p">)))</span></div><div class='line' id='LC64'>					<span class="p">,</span> <span class="nx">y</span> <span class="o">=</span> <span class="nx">proportion</span> <span class="o">*</span> <span class="nx">x</span></div><div class='line' id='LC65'>				<span class="k">this</span><span class="p">.</span><span class="nx">_length</span> <span class="o">=</span> <span class="nx">length</span></div><div class='line' id='LC66'>				<span class="k">this</span><span class="p">.</span><span class="nx">x</span> <span class="o">=</span> <span class="nx">x</span> <span class="o">*</span> <span class="nx">polarity</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">x</span><span class="p">)</span></div><div class='line' id='LC67'>				<span class="k">this</span><span class="p">.</span><span class="nx">y</span> <span class="o">=</span> <span class="nx">y</span> <span class="o">*</span> <span class="nx">polarity</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">y</span><span class="p">)</span></div><div class='line' id='LC68'>			<span class="p">}</span></div><div class='line' id='LC69'>			<span class="k">return</span> <span class="k">this</span></div><div class='line' id='LC70'>		<span class="p">}</span></div><div class='line' id='LC71'><br/></div><div class='line' id='LC72'>		<span class="cm">/**</span></div><div class='line' id='LC73'><span class="cm">		 * Calculates the angle between &#39;this&#39; vector and another.</span></div><div class='line' id='LC74'><span class="cm">		 * @public</span></div><div class='line' id='LC75'><span class="cm">		 * @function</span></div><div class='line' id='LC76'><span class="cm">		 * @returns {Number} The angle between the two vectors as measured in PI. </span></div><div class='line' id='LC77'><span class="cm">		 */</span></div><div class='line' id='LC78'>		<span class="k">this</span><span class="p">.</span><span class="nx">angleTo</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">vectorB</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC79'>			<span class="kd">var</span> <span class="nx">divisor</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getLength</span><span class="p">()</span> <span class="o">*</span> <span class="nx">vectorB</span><span class="p">.</span><span class="nx">getLength</span><span class="p">()</span></div><div class='line' id='LC80'>			<span class="k">if</span> <span class="p">(</span><span class="nx">divisor</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC81'>				<span class="k">return</span> <span class="mi">0</span></div><div class='line' id='LC82'>			<span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC83'>				<span class="c1">// JavaScript floating point math is screwed up.</span></div><div class='line' id='LC84'>				<span class="c1">// because of it, the core of the formula can, on occasion, have values</span></div><div class='line' id='LC85'>				<span class="c1">// over 1.0 and below -1.0.</span></div><div class='line' id='LC86'>				<span class="k">return</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">acos</span><span class="p">(</span></div><div class='line' id='LC87'>					<span class="nb">Math</span><span class="p">.</span><span class="nx">min</span><span class="p">(</span> </div><div class='line' id='LC88'>						<span class="nb">Math</span><span class="p">.</span><span class="nx">max</span><span class="p">(</span> </div><div class='line' id='LC89'>							<span class="p">(</span> <span class="k">this</span><span class="p">.</span><span class="nx">x</span> <span class="o">*</span> <span class="nx">vectorB</span><span class="p">.</span><span class="nx">x</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">y</span> <span class="o">*</span> <span class="nx">vectorB</span><span class="p">.</span><span class="nx">y</span> <span class="p">)</span> <span class="o">/</span> <span class="nx">divisor</span></div><div class='line' id='LC90'>							<span class="p">,</span> <span class="o">-</span><span class="mf">1.0</span></div><div class='line' id='LC91'>						<span class="p">)</span></div><div class='line' id='LC92'>						<span class="p">,</span> <span class="mf">1.0</span></div><div class='line' id='LC93'>					<span class="p">)</span></div><div class='line' id='LC94'>				<span class="p">)</span> <span class="o">/</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">PI</span></div><div class='line' id='LC95'>			<span class="p">}</span></div><div class='line' id='LC96'>		<span class="p">}</span></div><div class='line' id='LC97'>	<span class="p">}</span></div><div class='line' id='LC98'><br/></div><div class='line' id='LC99'>	<span class="kd">function</span> <span class="nx">Point</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span><span class="nx">y</span><span class="p">){</span></div><div class='line' id='LC100'>		<span class="k">this</span><span class="p">.</span><span class="nx">x</span> <span class="o">=</span> <span class="nx">x</span></div><div class='line' id='LC101'>		<span class="k">this</span><span class="p">.</span><span class="nx">y</span> <span class="o">=</span> <span class="nx">y</span></div><div class='line' id='LC102'><br/></div><div class='line' id='LC103'>		<span class="k">this</span><span class="p">.</span><span class="nx">getVectorToCoordinates</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC104'>			<span class="k">return</span> <span class="k">new</span> <span class="nx">Vector</span><span class="p">(</span><span class="nx">x</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">y</span><span class="p">)</span></div><div class='line' id='LC105'>		<span class="p">}</span></div><div class='line' id='LC106'>		<span class="k">this</span><span class="p">.</span><span class="nx">getVectorFromCoordinates</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC107'>			<span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">getVectorToCoordinates</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">).</span><span class="nx">reverse</span><span class="p">()</span></div><div class='line' id='LC108'>		<span class="p">}</span></div><div class='line' id='LC109'>		<span class="k">this</span><span class="p">.</span><span class="nx">getVectorToPoint</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">point</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC110'>			<span class="k">return</span> <span class="k">new</span> <span class="nx">Vector</span><span class="p">(</span><span class="nx">point</span><span class="p">.</span><span class="nx">x</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">point</span><span class="p">.</span><span class="nx">y</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">y</span><span class="p">)</span></div><div class='line' id='LC111'>		<span class="p">}</span></div><div class='line' id='LC112'>		<span class="k">this</span><span class="p">.</span><span class="nx">getVectorFromPoint</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">point</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC113'>			<span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">getVectorToPoint</span><span class="p">(</span><span class="nx">point</span><span class="p">).</span><span class="nx">reverse</span><span class="p">()</span></div><div class='line' id='LC114'>		<span class="p">}</span></div><div class='line' id='LC115'>	<span class="p">}</span></div><div class='line' id='LC116'><br/></div><div class='line' id='LC117'>	<span class="cm">/**</span></div><div class='line' id='LC118'><span class="cm">	Allows one to round a number to arbitrary precision.</span></div><div class='line' id='LC119'><span class="cm">	Math.round() rounds to whole only.</span></div><div class='line' id='LC120'><span class="cm">	Number.toFixed(precision) returns a string.</span></div><div class='line' id='LC121'><span class="cm">	I need float to float, but with arbitrary precision, hence:</span></div><div class='line' id='LC122'><br/></div><div class='line' id='LC123'><span class="cm">	@public</span></div><div class='line' id='LC124'><span class="cm">	@function</span></div><div class='line' id='LC125'><span class="cm">	@param number {Number}</span></div><div class='line' id='LC126'><span class="cm">	@param position {Number} number of digits right of decimal point to keep. If negative, rounding to the left of decimal.</span></div><div class='line' id='LC127'><span class="cm">	@returns {Type}</span></div><div class='line' id='LC128'><span class="cm">	*/</span></div><div class='line' id='LC129'>	<span class="kd">function</span> <span class="nx">round</span> <span class="p">(</span><span class="nx">number</span><span class="p">,</span> <span class="nx">position</span><span class="p">){</span></div><div class='line' id='LC130'>		<span class="kd">var</span> <span class="nx">tmp</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">pow</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="nx">position</span><span class="p">)</span></div><div class='line' id='LC131'>		<span class="k">return</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">round</span><span class="p">(</span> <span class="nx">number</span> <span class="o">*</span> <span class="nx">tmp</span> <span class="p">)</span> <span class="o">/</span> <span class="nx">tmp</span></div><div class='line' id='LC132'>	<span class="p">}</span></div><div class='line' id='LC133'><br/></div><div class='line' id='LC134'>	<span class="c1">//	/**</span></div><div class='line' id='LC135'>	<span class="c1">//	 * This is a simple, points-to-lines (not curves) renderer. </span></div><div class='line' id='LC136'>	<span class="c1">//	 * Keeping it around so we can activate it from time to time and see</span></div><div class='line' id='LC137'>	<span class="c1">//	 * if smoothing logic is off much.</span></div><div class='line' id='LC138'>	<span class="c1">//	 * @public</span></div><div class='line' id='LC139'>	<span class="c1">//	 * @function</span></div><div class='line' id='LC140'>	<span class="c1">//	 * @returns {String} Like so &quot;l 1 2 3 5&#39; with stroke as long line chain. </span></div><div class='line' id='LC141'>	<span class="c1">//	 */</span></div><div class='line' id='LC142'>	<span class="c1">//	function compressstroke(stroke, shiftx, shifty){</span></div><div class='line' id='LC143'>	<span class="c1">//		// we combine strokes data into string like this:</span></div><div class='line' id='LC144'>	<span class="c1">//		// &#39;M 53 7 l 1 2 3 4 -5 -6 5 -6&#39;</span></div><div class='line' id='LC145'>	<span class="c1">//		// see SVG documentation for Path element&#39;s &#39;d&#39; argument.</span></div><div class='line' id='LC146'>	<span class="c1">//		var lastx = stroke.x[0]</span></div><div class='line' id='LC147'>	<span class="c1">//		, lasty = stroke.y[0]</span></div><div class='line' id='LC148'>	<span class="c1">//		, i</span></div><div class='line' id='LC149'>	<span class="c1">//		, l = stroke.x.length</span></div><div class='line' id='LC150'>	<span class="c1">//		, answer = [&#39;M&#39;, lastx - shiftx, lasty - shifty, &#39;l&#39;]</span></div><div class='line' id='LC151'>	<span class="c1">//		</span></div><div class='line' id='LC152'>	<span class="c1">//		if (l === 1){</span></div><div class='line' id='LC153'>	<span class="c1">//			// meaning this was just a DOT, not a stroke.</span></div><div class='line' id='LC154'>	<span class="c1">//			// instead of creating a circle, we just create a short line</span></div><div class='line' id='LC155'>	<span class="c1">//			answer.concat(1, -1)</span></div><div class='line' id='LC156'>	<span class="c1">//		} else {</span></div><div class='line' id='LC157'>	<span class="c1">//			for(i = 1; i &lt; l; i++){</span></div><div class='line' id='LC158'>	<span class="c1">//				answer = answer.concat(stroke.x[i] - lastx, stroke.y[i] - lasty)</span></div><div class='line' id='LC159'>	<span class="c1">//				lastx = stroke.x[i]</span></div><div class='line' id='LC160'>	<span class="c1">//				lasty = stroke.y[i]</span></div><div class='line' id='LC161'>	<span class="c1">//			}</span></div><div class='line' id='LC162'>	<span class="c1">//		}</span></div><div class='line' id='LC163'>	<span class="c1">//		return answer.join(&#39; &#39;)</span></div><div class='line' id='LC164'>	<span class="c1">//	} </span></div><div class='line' id='LC165'><br/></div><div class='line' id='LC166'>	<span class="kd">function</span> <span class="nx">segmentToCurve</span><span class="p">(</span><span class="nx">stroke</span><span class="p">,</span> <span class="nx">positionInStroke</span><span class="p">,</span> <span class="nx">lineCurveThreshold</span><span class="p">){</span></div><div class='line' id='LC167'>		<span class="s1">&#39;use strict&#39;</span></div><div class='line' id='LC168'>		<span class="c1">// long lines (ones with many pixels between them) do not look good when they are part of a large curvy stroke.</span></div><div class='line' id='LC169'>		<span class="c1">// You know, the jaggedy crocodile spine instead of a pretty, smooth curve. Yuck!</span></div><div class='line' id='LC170'>		<span class="c1">// We want to approximate pretty curves in-place of those ugly lines.</span></div><div class='line' id='LC171'>		<span class="c1">// To approximate a very nice curve we need to know the direction of line before and after.</span></div><div class='line' id='LC172'>		<span class="c1">// Hence, on long lines we actually wait for another point beyond it to come back from</span></div><div class='line' id='LC173'>		<span class="c1">// mousemoved before we draw this curve.</span></div><div class='line' id='LC174'><br/></div><div class='line' id='LC175'>		<span class="c1">// So for &quot;prior curve&quot; to be calc&#39;ed we need 4 points </span></div><div class='line' id='LC176'>		<span class="c1">// 	A, B, C, D (we are on D now, A is 3 points in the past.)</span></div><div class='line' id='LC177'>		<span class="c1">// and 3 lines:</span></div><div class='line' id='LC178'>		<span class="c1">//  pre-line (from points A to B), </span></div><div class='line' id='LC179'>		<span class="c1">//  this line (from points B to C), (we call it &quot;this&quot; because if it was not yet, it&#39;s the only one we can draw for sure.) </span></div><div class='line' id='LC180'>		<span class="c1">//  post-line (from points C to D) (even through D point is &#39;current&#39; we don&#39;t know how we can draw it yet)</span></div><div class='line' id='LC181'>		<span class="c1">//</span></div><div class='line' id='LC182'>		<span class="c1">// Well, actually, we don&#39;t need to *know* the point A, just the vector A-&gt;B</span></div><div class='line' id='LC183'><br/></div><div class='line' id='LC184'>		<span class="c1">// Again, we can only derive curve between points positionInStroke-1 and positionInStroke</span></div><div class='line' id='LC185'>		<span class="c1">// Thus, since we can only draw a line if we know one point ahead of it, we need to shift our focus one point ahead.</span></div><div class='line' id='LC186'>		<span class="nx">positionInStroke</span> <span class="o">+=</span> <span class="mi">1</span></div><div class='line' id='LC187'>		<span class="c1">// Let&#39;s hope the code that calls us knows we do that and does not call us with positionInStroke = index of last point.</span></div><div class='line' id='LC188'><br/></div><div class='line' id='LC189'>		<span class="kd">var</span> <span class="nx">Cpoint</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Point</span><span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="nx">stroke</span><span class="p">.</span><span class="nx">y</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span></div><div class='line' id='LC190'>			<span class="p">,</span> <span class="nx">Dpoint</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Point</span><span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="p">],</span> <span class="nx">stroke</span><span class="p">.</span><span class="nx">y</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="p">])</span></div><div class='line' id='LC191'>			<span class="p">,</span> <span class="nx">CDvector</span> <span class="o">=</span> <span class="nx">Cpoint</span><span class="p">.</span><span class="nx">getVectorToPoint</span><span class="p">(</span><span class="nx">Dpoint</span><span class="p">)</span></div><div class='line' id='LC192'>		<span class="c1">// Again, we have a chance here to draw only PREVIOUS line segment - BC</span></div><div class='line' id='LC193'><br/></div><div class='line' id='LC194'>		<span class="c1">// So, let&#39;s start with BC curve.</span></div><div class='line' id='LC195'>		<span class="c1">// if there is only 2 points in stroke array (C, D), we don&#39;t have &quot;history&quot; long enough to have point B, let alone point A.</span></div><div class='line' id='LC196'>		<span class="c1">// so positionInStroke should start with 2, ie</span></div><div class='line' id='LC197'>		<span class="c1">// we are here when there are at least 3 points in stroke array.</span></div><div class='line' id='LC198'>		<span class="kd">var</span> <span class="nx">Bpoint</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Point</span><span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="o">-</span><span class="mi">2</span><span class="p">],</span> <span class="nx">stroke</span><span class="p">.</span><span class="nx">y</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="o">-</span><span class="mi">2</span><span class="p">])</span></div><div class='line' id='LC199'>		<span class="p">,</span> <span class="nx">BCvector</span> <span class="o">=</span> <span class="nx">Bpoint</span><span class="p">.</span><span class="nx">getVectorToPoint</span><span class="p">(</span><span class="nx">Cpoint</span><span class="p">)</span></div><div class='line' id='LC200'>		<span class="p">,</span> <span class="nx">ABvector</span></div><div class='line' id='LC201'>		<span class="p">,</span> <span class="nx">rounding</span> <span class="o">=</span> <span class="mi">2</span></div><div class='line' id='LC202'><br/></div><div class='line' id='LC203'>		<span class="k">if</span> <span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">getLength</span><span class="p">()</span> <span class="o">&gt;</span> <span class="nx">lineCurveThreshold</span> <span class="p">){</span></div><div class='line' id='LC204'>			<span class="c1">// Yey! Pretty curves, here we come!</span></div><div class='line' id='LC205'>			<span class="k">if</span><span class="p">(</span><span class="nx">positionInStroke</span> <span class="o">&gt;</span> <span class="mi">2</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC206'>				<span class="nx">ABvector</span> <span class="o">=</span> <span class="p">(</span><span class="k">new</span> <span class="nx">Point</span><span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="o">-</span><span class="mi">3</span><span class="p">],</span> <span class="nx">stroke</span><span class="p">.</span><span class="nx">y</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="o">-</span><span class="mi">3</span><span class="p">])).</span><span class="nx">getVectorToPoint</span><span class="p">(</span><span class="nx">Bpoint</span><span class="p">)</span></div><div class='line' id='LC207'>			<span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC208'>				<span class="nx">ABvector</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Vector</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC209'>			<span class="p">}</span></div><div class='line' id='LC210'>			<span class="kd">var</span> <span class="nx">minlenfraction</span> <span class="o">=</span> <span class="mf">0.05</span></div><div class='line' id='LC211'>			<span class="p">,</span> <span class="nx">maxlen</span> <span class="o">=</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">getLength</span><span class="p">()</span> <span class="o">*</span> <span class="mf">0.35</span></div><div class='line' id='LC212'>			<span class="p">,</span> <span class="nx">ABCangle</span> <span class="o">=</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">angleTo</span><span class="p">(</span><span class="nx">ABvector</span><span class="p">.</span><span class="nx">reverse</span><span class="p">())</span></div><div class='line' id='LC213'>			<span class="p">,</span> <span class="nx">BCDangle</span> <span class="o">=</span> <span class="nx">CDvector</span><span class="p">.</span><span class="nx">angleTo</span><span class="p">(</span><span class="nx">BCvector</span><span class="p">.</span><span class="nx">reverse</span><span class="p">())</span></div><div class='line' id='LC214'>			<span class="p">,</span> <span class="nx">BtoCP1vector</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Vector</span><span class="p">(</span><span class="nx">ABvector</span><span class="p">.</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">ABvector</span><span class="p">.</span><span class="nx">y</span> <span class="o">+</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">y</span><span class="p">).</span><span class="nx">resizeTo</span><span class="p">(</span></div><div class='line' id='LC215'>				<span class="nb">Math</span><span class="p">.</span><span class="nx">max</span><span class="p">(</span><span class="nx">minlenfraction</span><span class="p">,</span> <span class="nx">ABCangle</span><span class="p">)</span> <span class="o">*</span> <span class="nx">maxlen</span></div><div class='line' id='LC216'>			<span class="p">)</span></div><div class='line' id='LC217'>			<span class="p">,</span> <span class="nx">CtoCP2vector</span> <span class="o">=</span> <span class="p">(</span><span class="k">new</span> <span class="nx">Vector</span><span class="p">(</span><span class="nx">BCvector</span><span class="p">.</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">CDvector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">y</span> <span class="o">+</span> <span class="nx">CDvector</span><span class="p">.</span><span class="nx">y</span><span class="p">)).</span><span class="nx">reverse</span><span class="p">().</span><span class="nx">resizeTo</span><span class="p">(</span></div><div class='line' id='LC218'>				<span class="nb">Math</span><span class="p">.</span><span class="nx">max</span><span class="p">(</span><span class="nx">minlenfraction</span><span class="p">,</span> <span class="nx">BCDangle</span><span class="p">)</span> <span class="o">*</span> <span class="nx">maxlen</span></div><div class='line' id='LC219'>			<span class="p">)</span></div><div class='line' id='LC220'>			<span class="p">,</span> <span class="nx">BtoCP2vector</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Vector</span><span class="p">(</span><span class="nx">BCvector</span><span class="p">.</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">CtoCP2vector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">y</span> <span class="o">+</span> <span class="nx">CtoCP2vector</span><span class="p">.</span><span class="nx">y</span><span class="p">)</span></div><div class='line' id='LC221'><br/></div><div class='line' id='LC222'>			<span class="c1">// returing curve for BC segment</span></div><div class='line' id='LC223'>			<span class="c1">// all coords are vectors against Bpoint</span></div><div class='line' id='LC224'>			<span class="k">return</span> <span class="p">[</span></div><div class='line' id='LC225'>				<span class="s1">&#39;c&#39;</span> <span class="c1">// bezier curve</span></div><div class='line' id='LC226'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BtoCP1vector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC227'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BtoCP1vector</span><span class="p">.</span><span class="nx">y</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC228'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BtoCP2vector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC229'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BtoCP2vector</span><span class="p">.</span><span class="nx">y</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC230'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC231'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">y</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC232'>			<span class="p">]</span></div><div class='line' id='LC233'>		<span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC234'>			<span class="k">return</span> <span class="p">[</span></div><div class='line' id='LC235'>				<span class="s1">&#39;l&#39;</span> <span class="c1">// line</span></div><div class='line' id='LC236'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC237'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">y</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC238'>			<span class="p">]</span></div><div class='line' id='LC239'>		<span class="p">}</span></div><div class='line' id='LC240'>	<span class="p">}</span></div><div class='line' id='LC241'><br/></div><div class='line' id='LC242'>	<span class="kd">function</span> <span class="nx">lastSegmentToCurve</span><span class="p">(</span><span class="nx">stroke</span><span class="p">,</span> <span class="nx">lineCurveThreshold</span><span class="p">){</span></div><div class='line' id='LC243'>		<span class="s1">&#39;use strict&#39;</span></div><div class='line' id='LC244'>		<span class="c1">// Here we tidy up things left unfinished</span></div><div class='line' id='LC245'><br/></div><div class='line' id='LC246'>		<span class="c1">// What&#39;s left unfinished there is the curve between the last points</span></div><div class='line' id='LC247'>		<span class="c1">// in the stroke</span></div><div class='line' id='LC248'>		<span class="c1">// We can also be called when there is only one point in the stroke (meaning, the </span></div><div class='line' id='LC249'>		<span class="c1">// stroke was just a dot), in which case there is nothing for us to do.</span></div><div class='line' id='LC250'><br/></div><div class='line' id='LC251'>		<span class="c1">// So for &quot;this curve&quot; to be calc&#39;ed we need 3 points </span></div><div class='line' id='LC252'>		<span class="c1">// 	A, B, C</span></div><div class='line' id='LC253'>		<span class="c1">// and 2 lines:</span></div><div class='line' id='LC254'>		<span class="c1">//  pre-line (from points A to B), </span></div><div class='line' id='LC255'>		<span class="c1">//  this line (from points B to C) </span></div><div class='line' id='LC256'>		<span class="c1">// Well, actually, we don&#39;t need to *know* the point A, just the vector A-&gt;B</span></div><div class='line' id='LC257'>		<span class="c1">// so, we really need points B, C and AB vector.</span></div><div class='line' id='LC258'>		<span class="kd">var</span> <span class="nx">positionInStroke</span> <span class="o">=</span> <span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">.</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span></div><div class='line' id='LC259'><br/></div><div class='line' id='LC260'>		<span class="c1">// there must be at least 2 points in the stroke.for us to work. Hope calling code checks for that.</span></div><div class='line' id='LC261'>		<span class="kd">var</span> <span class="nx">Cpoint</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Point</span><span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="p">],</span> <span class="nx">stroke</span><span class="p">.</span><span class="nx">y</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="p">])</span></div><div class='line' id='LC262'>		<span class="p">,</span> <span class="nx">Bpoint</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Point</span><span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="nx">stroke</span><span class="p">.</span><span class="nx">y</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span></div><div class='line' id='LC263'>		<span class="p">,</span> <span class="nx">BCvector</span> <span class="o">=</span> <span class="nx">Bpoint</span><span class="p">.</span><span class="nx">getVectorToPoint</span><span class="p">(</span><span class="nx">Cpoint</span><span class="p">)</span></div><div class='line' id='LC264'>		<span class="p">,</span> <span class="nx">rounding</span> <span class="o">=</span> <span class="mi">2</span></div><div class='line' id='LC265'><br/></div><div class='line' id='LC266'>		<span class="k">if</span> <span class="p">(</span><span class="nx">positionInStroke</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="o">&amp;&amp;</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">getLength</span><span class="p">()</span> <span class="o">&gt;</span> <span class="nx">lineCurveThreshold</span><span class="p">){</span></div><div class='line' id='LC267'>			<span class="c1">// we have at least 3 elems in stroke</span></div><div class='line' id='LC268'>			<span class="kd">var</span> <span class="nx">ABvector</span> <span class="o">=</span> <span class="p">(</span><span class="k">new</span> <span class="nx">Point</span><span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="o">-</span><span class="mi">2</span><span class="p">],</span> <span class="nx">stroke</span><span class="p">.</span><span class="nx">y</span><span class="p">[</span><span class="nx">positionInStroke</span><span class="o">-</span><span class="mi">2</span><span class="p">])).</span><span class="nx">getVectorToPoint</span><span class="p">(</span><span class="nx">Bpoint</span><span class="p">)</span></div><div class='line' id='LC269'>			<span class="p">,</span> <span class="nx">ABCangle</span> <span class="o">=</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">angleTo</span><span class="p">(</span><span class="nx">ABvector</span><span class="p">.</span><span class="nx">reverse</span><span class="p">())</span></div><div class='line' id='LC270'>			<span class="p">,</span> <span class="nx">minlenfraction</span> <span class="o">=</span> <span class="mf">0.05</span></div><div class='line' id='LC271'>			<span class="p">,</span> <span class="nx">maxlen</span> <span class="o">=</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">getLength</span><span class="p">()</span> <span class="o">*</span> <span class="mf">0.35</span></div><div class='line' id='LC272'>			<span class="p">,</span> <span class="nx">BtoCP1vector</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Vector</span><span class="p">(</span><span class="nx">ABvector</span><span class="p">.</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">ABvector</span><span class="p">.</span><span class="nx">y</span> <span class="o">+</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">y</span><span class="p">).</span><span class="nx">resizeTo</span><span class="p">(</span></div><div class='line' id='LC273'>				<span class="nb">Math</span><span class="p">.</span><span class="nx">max</span><span class="p">(</span><span class="nx">minlenfraction</span><span class="p">,</span> <span class="nx">ABCangle</span><span class="p">)</span> <span class="o">*</span> <span class="nx">maxlen</span></div><div class='line' id='LC274'>			<span class="p">)</span></div><div class='line' id='LC275'><br/></div><div class='line' id='LC276'>			<span class="k">return</span> <span class="p">[</span></div><div class='line' id='LC277'>				<span class="s1">&#39;c&#39;</span> <span class="c1">// bezier curve</span></div><div class='line' id='LC278'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BtoCP1vector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC279'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BtoCP1vector</span><span class="p">.</span><span class="nx">y</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC280'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span> <span class="c1">// CP2 is same as Cpoint</span></div><div class='line' id='LC281'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">y</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span> <span class="c1">// CP2 is same as Cpoint</span></div><div class='line' id='LC282'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC283'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">y</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC284'>			<span class="p">]</span></div><div class='line' id='LC285'>		<span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC286'>			<span class="c1">// Since there is no AB leg, there is no curve to draw. This is just line</span></div><div class='line' id='LC287'>			<span class="k">return</span> <span class="p">[</span></div><div class='line' id='LC288'>				<span class="s1">&#39;l&#39;</span> <span class="c1">// simple line</span></div><div class='line' id='LC289'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">x</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC290'>				<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="nx">BCvector</span><span class="p">.</span><span class="nx">y</span><span class="p">,</span> <span class="nx">rounding</span> <span class="p">)</span></div><div class='line' id='LC291'>			<span class="p">]</span></div><div class='line' id='LC292'>		<span class="p">}</span></div><div class='line' id='LC293'>	<span class="p">}</span></div><div class='line' id='LC294'><br/></div><div class='line' id='LC295'>	<span class="kd">function</span> <span class="nx">addstroke</span><span class="p">(</span><span class="nx">stroke</span><span class="p">,</span> <span class="nx">shiftx</span><span class="p">,</span> <span class="nx">shifty</span><span class="p">){</span></div><div class='line' id='LC296'>		<span class="s1">&#39;use strict&#39;</span></div><div class='line' id='LC297'>		<span class="c1">// we combine strokes data into string like this:</span></div><div class='line' id='LC298'>		<span class="c1">// &#39;M 53 7 l 1 2 c 3 4 -5 -6 5 -6&#39;</span></div><div class='line' id='LC299'>		<span class="c1">// see SVG documentation for Path element&#39;s &#39;d&#39; argument.</span></div><div class='line' id='LC300'>		<span class="kd">var</span> <span class="nx">lines</span> <span class="o">=</span> <span class="p">[</span></div><div class='line' id='LC301'>			<span class="s1">&#39;M&#39;</span> <span class="c1">// move to</span></div><div class='line' id='LC302'>			<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">-</span> <span class="nx">shiftx</span><span class="p">),</span> <span class="mi">2</span><span class="p">)</span></div><div class='line' id='LC303'>			<span class="p">,</span> <span class="nx">round</span><span class="p">(</span> <span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">y</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">-</span> <span class="nx">shifty</span><span class="p">),</span> <span class="mi">2</span><span class="p">)</span></div><div class='line' id='LC304'>		<span class="p">]</span></div><div class='line' id='LC305'>		<span class="c1">// processing all points but first and last. </span></div><div class='line' id='LC306'>		<span class="p">,</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">1</span> <span class="c1">// index zero item in there is STARTING point. we already extracted it.</span></div><div class='line' id='LC307'>		<span class="p">,</span> <span class="nx">l</span> <span class="o">=</span> <span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">.</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span> <span class="c1">// this is a trick. We are leaving last point coordinates for separate processing.</span></div><div class='line' id='LC308'>		<span class="p">,</span> <span class="nx">lineCurveThreshold</span> <span class="o">=</span> <span class="mi">1</span></div><div class='line' id='LC309'><br/></div><div class='line' id='LC310'>		<span class="k">for</span><span class="p">(;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">l</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">){</span></div><div class='line' id='LC311'>			<span class="nx">lines</span><span class="p">.</span><span class="nx">push</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">lines</span><span class="p">,</span> <span class="nx">segmentToCurve</span><span class="p">(</span><span class="nx">stroke</span><span class="p">,</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">lineCurveThreshold</span><span class="p">))</span></div><div class='line' id='LC312'>		<span class="p">}</span></div><div class='line' id='LC313'>		<span class="k">if</span> <span class="p">(</span><span class="nx">l</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="cm">/* effectively more than 1, since we &quot;-1&quot; above */</span><span class="p">){</span></div><div class='line' id='LC314'>			<span class="nx">lines</span><span class="p">.</span><span class="nx">push</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">lines</span><span class="p">,</span> <span class="nx">lastSegmentToCurve</span><span class="p">(</span><span class="nx">stroke</span><span class="p">,</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">lineCurveThreshold</span><span class="p">))</span></div><div class='line' id='LC315'>		<span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">l</span> <span class="o">===</span> <span class="mi">0</span><span class="p">){</span></div><div class='line' id='LC316'>			<span class="c1">// meaning we only have ONE point in the stroke (and otherwise refer to the stroke as &quot;dot&quot;)</span></div><div class='line' id='LC317'>			<span class="nx">lines</span><span class="p">.</span><span class="nx">push</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">lines</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;l&#39;</span> <span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span></div><div class='line' id='LC318'>		<span class="p">}</span></div><div class='line' id='LC319'>		<span class="k">return</span> <span class="nx">lines</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">)</span></div><div class='line' id='LC320'>	<span class="p">}</span></div><div class='line' id='LC321'><br/></div><div class='line' id='LC322'>	<span class="kd">function</span> <span class="nx">simplifystroke</span><span class="p">(</span><span class="nx">stroke</span><span class="p">){</span></div><div class='line' id='LC323'>		<span class="kd">var</span> <span class="nx">d</span> <span class="o">=</span> <span class="p">[]</span></div><div class='line' id='LC324'>		<span class="p">,</span> <span class="nx">newstroke</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;x&#39;</span><span class="o">:</span><span class="p">[],</span> <span class="s1">&#39;y&#39;</span><span class="o">:</span><span class="p">[]}</span></div><div class='line' id='LC325'>		<span class="p">,</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">l</span></div><div class='line' id='LC326'><br/></div><div class='line' id='LC327'>		<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">l</span> <span class="o">=</span> <span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">l</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">){</span></div><div class='line' id='LC328'>			<span class="nx">d</span><span class="p">.</span><span class="nx">push</span><span class="p">({</span><span class="s1">&#39;x&#39;</span><span class="o">:</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">[</span><span class="nx">i</span><span class="p">],</span> <span class="s1">&#39;y&#39;</span><span class="o">:</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">y</span><span class="p">[</span><span class="nx">i</span><span class="p">]})</span></div><div class='line' id='LC329'>		<span class="p">}</span></div><div class='line' id='LC330'>		<span class="nx">d</span> <span class="o">=</span> <span class="nx">simplify</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="mf">0.7</span><span class="p">,</span> <span class="kc">true</span><span class="p">)</span></div><div class='line' id='LC331'>		<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">l</span> <span class="o">=</span> <span class="nx">d</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">l</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">){</span></div><div class='line' id='LC332'>			<span class="nx">newstroke</span><span class="p">.</span><span class="nx">x</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">d</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">x</span><span class="p">)</span></div><div class='line' id='LC333'>			<span class="nx">newstroke</span><span class="p">.</span><span class="nx">y</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">d</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">y</span><span class="p">)</span></div><div class='line' id='LC334'>		<span class="p">}</span>		</div><div class='line' id='LC335'>		<span class="k">return</span> <span class="nx">newstroke</span></div><div class='line' id='LC336'>	<span class="p">}</span></div><div class='line' id='LC337'><br/></div><div class='line' id='LC338'>	<span class="kd">function</span> <span class="nx">compressstrokes</span><span class="p">(</span><span class="nx">data</span><span class="p">){</span></div><div class='line' id='LC339'>		<span class="s1">&#39;use strict&#39;</span></div><div class='line' id='LC340'>		<span class="kd">var</span> <span class="nx">answer</span> <span class="o">=</span> <span class="p">[</span></div><div class='line' id='LC341'>			<span class="s1">&#39;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#39;</span></div><div class='line' id='LC342'>			<span class="p">,</span> <span class="s1">&#39;&lt;!DOCTYPE svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot; &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;&gt;&#39;</span></div><div class='line' id='LC343'>	    <span class="p">]</span></div><div class='line' id='LC344'>		<span class="p">,</span> <span class="nx">i</span> <span class="p">,</span> <span class="nx">l</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">length</span></div><div class='line' id='LC345'>		<span class="p">,</span> <span class="nx">stroke</span></div><div class='line' id='LC346'>		<span class="p">,</span> <span class="nx">xlimits</span> <span class="o">=</span> <span class="p">[]</span></div><div class='line' id='LC347'>		<span class="p">,</span> <span class="nx">ylimits</span> <span class="o">=</span> <span class="p">[]</span></div><div class='line' id='LC348'>		<span class="p">,</span> <span class="nx">sizex</span> <span class="o">=</span> <span class="mi">0</span></div><div class='line' id='LC349'>		<span class="p">,</span> <span class="nx">sizey</span> <span class="o">=</span> <span class="mi">0</span></div><div class='line' id='LC350'>		<span class="p">,</span> <span class="nx">shiftx</span> <span class="o">=</span> <span class="mi">0</span></div><div class='line' id='LC351'>		<span class="p">,</span> <span class="nx">shifty</span> <span class="o">=</span> <span class="mi">0</span></div><div class='line' id='LC352'>		<span class="p">,</span> <span class="nx">minx</span><span class="p">,</span> <span class="nx">maxx</span><span class="p">,</span> <span class="nx">miny</span><span class="p">,</span> <span class="nx">maxy</span><span class="p">,</span> <span class="nx">padding</span> <span class="o">=</span> <span class="mi">1</span></div><div class='line' id='LC353'>		<span class="p">,</span> <span class="nx">simplifieddata</span> <span class="o">=</span> <span class="p">[]</span></div><div class='line' id='LC354'><br/></div><div class='line' id='LC355'>		<span class="k">if</span><span class="p">(</span><span class="nx">l</span> <span class="o">!==</span> <span class="mi">0</span><span class="p">){</span></div><div class='line' id='LC356'>			<span class="k">for</span><span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">l</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">){</span></div><div class='line' id='LC357'>				<span class="nx">stroke</span> <span class="o">=</span> <span class="nx">simplifystroke</span><span class="p">(</span> <span class="nx">data</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="p">)</span></div><div class='line' id='LC358'>				<span class="nx">simplifieddata</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">stroke</span><span class="p">)</span></div><div class='line' id='LC359'>				<span class="nx">xlimits</span> <span class="o">=</span> <span class="nx">xlimits</span><span class="p">.</span><span class="nx">concat</span><span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">x</span><span class="p">)</span></div><div class='line' id='LC360'>				<span class="nx">ylimits</span> <span class="o">=</span> <span class="nx">ylimits</span><span class="p">.</span><span class="nx">concat</span><span class="p">(</span><span class="nx">stroke</span><span class="p">.</span><span class="nx">y</span><span class="p">)</span></div><div class='line' id='LC361'>			<span class="p">}</span></div><div class='line' id='LC362'><br/></div><div class='line' id='LC363'>			<span class="nx">minx</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">min</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">xlimits</span><span class="p">)</span> <span class="o">-</span> <span class="nx">padding</span></div><div class='line' id='LC364'>			<span class="nx">maxx</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">max</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">xlimits</span><span class="p">)</span> <span class="o">+</span> <span class="nx">padding</span></div><div class='line' id='LC365'>			<span class="nx">miny</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">min</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">ylimits</span><span class="p">)</span> <span class="o">-</span> <span class="nx">padding</span></div><div class='line' id='LC366'>			<span class="nx">maxy</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">max</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">ylimits</span><span class="p">)</span> <span class="o">+</span> <span class="nx">padding</span></div><div class='line' id='LC367'>			<span class="nx">shiftx</span> <span class="o">=</span> <span class="nx">minx</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="o">?</span> <span class="mi">0</span> <span class="o">:</span> <span class="nx">minx</span></div><div class='line' id='LC368'>			<span class="nx">shifty</span> <span class="o">=</span> <span class="nx">miny</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="o">?</span> <span class="mi">0</span> <span class="o">:</span> <span class="nx">miny</span></div><div class='line' id='LC369'>			<span class="nx">sizex</span> <span class="o">=</span> <span class="nx">maxx</span> <span class="o">-</span> <span class="nx">minx</span></div><div class='line' id='LC370'>			<span class="nx">sizey</span> <span class="o">=</span> <span class="nx">maxy</span> <span class="o">-</span> <span class="nx">miny</span></div><div class='line' id='LC371'>		<span class="p">}</span></div><div class='line' id='LC372'><br/></div><div class='line' id='LC373'>		<span class="nx">answer</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span></div><div class='line' id='LC374'>			<span class="s1">&#39;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot; width=&quot;&#39;</span><span class="o">+</span> </div><div class='line' id='LC375'>			<span class="nx">sizex</span><span class="p">.</span><span class="nx">toString</span><span class="p">()</span> <span class="o">+</span></div><div class='line' id='LC376'>			<span class="s1">&#39;&quot; height=&quot;&#39;</span><span class="o">+</span> </div><div class='line' id='LC377'>			<span class="nx">sizey</span><span class="p">.</span><span class="nx">toString</span><span class="p">()</span> <span class="o">+</span></div><div class='line' id='LC378'>			<span class="s1">&#39;&quot;&gt;&#39;</span></div><div class='line' id='LC379'>		<span class="p">)</span></div><div class='line' id='LC380'><br/></div><div class='line' id='LC381'>	<span class="c1">//		// This is a nice idea: use style declaration on top, and mark the lines with &#39;class=&quot;f&quot;&#39;</span></div><div class='line' id='LC382'>	<span class="c1">//		// thus saving space in svg... </span></div><div class='line' id='LC383'>	<span class="c1">//		// alas, many SVG renderers don&#39;t understand &quot;class&quot; and render the strokes in default &quot;fill = black, no stroke&quot; style. Ugh!!!</span></div><div class='line' id='LC384'>	<span class="c1">//		// TODO: Rewrite ImageMagic / GraphicsMagic, InkScape, http://svg.codeplex.com/ to support style + class. until then, we hardcode the stroke style within the path. </span></div><div class='line' id='LC385'>	<span class="c1">//		answer.push(</span></div><div class='line' id='LC386'>	<span class="c1">//			&#39;&lt;style type=&quot;text/css&quot;&gt;&lt;![CDATA[.f {fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}]]&gt;&lt;/style&gt;&#39;</span></div><div class='line' id='LC387'>	<span class="c1">//		)</span></div><div class='line' id='LC388'><br/></div><div class='line' id='LC389'>	<span class="c1">//		// This set is accompaniment to &quot;simple line renderer&quot; - compressstroke</span></div><div class='line' id='LC390'>	<span class="c1">//		answer.push(</span></div><div class='line' id='LC391'>	<span class="c1">//			&#39;&lt;style type=&quot;text/css&quot;&gt;&lt;![CDATA[.t {fill:none;stroke:#FF0000;stroke-width:2}]]&gt;&lt;/style&gt;&#39;</span></div><div class='line' id='LC392'>	<span class="c1">//		)</span></div><div class='line' id='LC393'>	<span class="c1">//		for(i = 0; i &lt; l; i++){</span></div><div class='line' id='LC394'>	<span class="c1">//			stroke = data[i]</span></div><div class='line' id='LC395'>	<span class="c1">//			// This one is accompaniment to &quot;simple line renderer&quot;</span></div><div class='line' id='LC396'>	<span class="c1">//			answer.push(&#39;&lt;path class=&quot;t&quot; d=&quot;&#39;+ compressstroke(stroke, shiftx, shifty) +&#39;&quot;/&gt;&#39;)</span></div><div class='line' id='LC397'>	<span class="c1">//		}</span></div><div class='line' id='LC398'><br/></div><div class='line' id='LC399'>		<span class="k">for</span><span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">l</span> <span class="o">=</span> <span class="nx">simplifieddata</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">l</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">){</span></div><div class='line' id='LC400'>			<span class="nx">stroke</span> <span class="o">=</span> <span class="nx">simplifieddata</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span></div><div class='line' id='LC401'>			<span class="nx">answer</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="s1">&#39;&lt;path fill=&quot;none&quot; stroke=&quot;#000000&quot; stroke-width=&quot;2&quot; stroke-linecap=&quot;round&quot; stroke-linejoin=&quot;round&quot; d=&quot;&#39;</span><span class="o">+</span> <span class="nx">addstroke</span><span class="p">(</span><span class="nx">stroke</span><span class="p">,</span> <span class="nx">shiftx</span><span class="p">,</span> <span class="nx">shifty</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;&quot;/&gt;&#39;</span><span class="p">)</span></div><div class='line' id='LC402'>		<span class="p">}</span></div><div class='line' id='LC403'>		<span class="nx">answer</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="s1">&#39;&lt;/svg&gt;&#39;</span><span class="p">)</span></div><div class='line' id='LC404'>		<span class="k">return</span> <span class="nx">answer</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;&#39;</span><span class="p">)</span></div><div class='line' id='LC405'>	<span class="p">}</span></div><div class='line' id='LC406'><br/></div><div class='line' id='LC407'>	<span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">btoa</span> <span class="o">!==</span> <span class="s1">&#39;function&#39;</span><span class="p">)</span></div><div class='line' id='LC408'>	<span class="p">{</span></div><div class='line' id='LC409'>		<span class="kd">var</span> <span class="nx">btoa</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC410'><span class="cm">/** @preserve</span></div><div class='line' id='LC411'><span class="cm">base64 encoder</span></div><div class='line' id='LC412'><span class="cm">MIT, GPL</span></div><div class='line' id='LC413'><span class="cm">http://phpjs.org/functions/base64_encode</span></div><div class='line' id='LC414'><span class="cm">+   original by: Tyler Akins (http://rumkin.com)</span></div><div class='line' id='LC415'><span class="cm">+   improved by: Bayron Guevara</span></div><div class='line' id='LC416'><span class="cm">+   improved by: Thunder.m</span></div><div class='line' id='LC417'><span class="cm">+   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)</span></div><div class='line' id='LC418'><span class="cm">+   bugfixed by: Pellentesque Malesuada</span></div><div class='line' id='LC419'><span class="cm">+   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)</span></div><div class='line' id='LC420'><span class="cm">+   improved by: Rafal Kukawski (http://kukawski.pl)</span></div><div class='line' id='LC421'><br/></div><div class='line' id='LC422'><span class="cm">*/</span></div><div class='line' id='LC423'>		    <span class="kd">var</span> <span class="nx">b64</span> <span class="o">=</span> <span class="s2">&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=&quot;</span></div><div class='line' id='LC424'>		    <span class="p">,</span> <span class="nx">b64a</span> <span class="o">=</span> <span class="nx">b64</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s1">&#39;&#39;</span><span class="p">)</span></div><div class='line' id='LC425'>		    <span class="p">,</span> <span class="nx">o1</span><span class="p">,</span> <span class="nx">o2</span><span class="p">,</span> <span class="nx">o3</span><span class="p">,</span> <span class="nx">h1</span><span class="p">,</span> <span class="nx">h2</span><span class="p">,</span> <span class="nx">h3</span><span class="p">,</span> <span class="nx">h4</span><span class="p">,</span> <span class="nx">bits</span><span class="p">,</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span></div><div class='line' id='LC426'>	        <span class="nx">ac</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span></div><div class='line' id='LC427'>	        <span class="nx">enc</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">,</span></div><div class='line' id='LC428'>	        <span class="nx">tmp_arr</span> <span class="o">=</span> <span class="p">[];</span></div><div class='line' id='LC429'><br/></div><div class='line' id='LC430'>		    <span class="k">do</span> <span class="p">{</span> <span class="c1">// pack three octets into four hexets</span></div><div class='line' id='LC431'>		        <span class="nx">o1</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">charCodeAt</span><span class="p">(</span><span class="nx">i</span><span class="o">++</span><span class="p">);</span></div><div class='line' id='LC432'>		        <span class="nx">o2</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">charCodeAt</span><span class="p">(</span><span class="nx">i</span><span class="o">++</span><span class="p">);</span></div><div class='line' id='LC433'>		        <span class="nx">o3</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">charCodeAt</span><span class="p">(</span><span class="nx">i</span><span class="o">++</span><span class="p">);</span></div><div class='line' id='LC434'><br/></div><div class='line' id='LC435'>		        <span class="nx">bits</span> <span class="o">=</span> <span class="nx">o1</span> <span class="o">&lt;&lt;</span> <span class="mi">16</span> <span class="o">|</span> <span class="nx">o2</span> <span class="o">&lt;&lt;</span> <span class="mi">8</span> <span class="o">|</span> <span class="nx">o3</span><span class="p">;</span></div><div class='line' id='LC436'><br/></div><div class='line' id='LC437'>		        <span class="nx">h1</span> <span class="o">=</span> <span class="nx">bits</span> <span class="o">&gt;&gt;</span> <span class="mi">18</span> <span class="o">&amp;</span> <span class="mh">0x3f</span><span class="p">;</span></div><div class='line' id='LC438'>		        <span class="nx">h2</span> <span class="o">=</span> <span class="nx">bits</span> <span class="o">&gt;&gt;</span> <span class="mi">12</span> <span class="o">&amp;</span> <span class="mh">0x3f</span><span class="p">;</span></div><div class='line' id='LC439'>		        <span class="nx">h3</span> <span class="o">=</span> <span class="nx">bits</span> <span class="o">&gt;&gt;</span> <span class="mi">6</span> <span class="o">&amp;</span> <span class="mh">0x3f</span><span class="p">;</span></div><div class='line' id='LC440'>		        <span class="nx">h4</span> <span class="o">=</span> <span class="nx">bits</span> <span class="o">&amp;</span> <span class="mh">0x3f</span><span class="p">;</span></div><div class='line' id='LC441'><br/></div><div class='line' id='LC442'>		        <span class="c1">// use hexets to index into b64, and append result to encoded string</span></div><div class='line' id='LC443'>		        <span class="nx">tmp_arr</span><span class="p">[</span><span class="nx">ac</span><span class="o">++</span><span class="p">]</span> <span class="o">=</span> <span class="nx">b64a</span><span class="p">[</span><span class="nx">h1</span><span class="p">]</span> <span class="o">+</span> <span class="nx">b64a</span><span class="p">[</span><span class="nx">h2</span><span class="p">]</span> <span class="o">+</span> <span class="nx">b64a</span><span class="p">[</span><span class="nx">h3</span><span class="p">]</span> <span class="o">+</span> <span class="nx">b64a</span><span class="p">[</span><span class="nx">h4</span><span class="p">];</span></div><div class='line' id='LC444'>		    <span class="p">}</span> <span class="k">while</span> <span class="p">(</span><span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">data</span><span class="p">.</span><span class="nx">length</span><span class="p">);</span></div><div class='line' id='LC445'><br/></div><div class='line' id='LC446'>		    <span class="nx">enc</span> <span class="o">=</span> <span class="nx">tmp_arr</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;&#39;</span><span class="p">);</span></div><div class='line' id='LC447'>		    <span class="kd">var</span> <span class="nx">r</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">length</span> <span class="o">%</span> <span class="mi">3</span><span class="p">;</span></div><div class='line' id='LC448'>		    <span class="k">return</span> <span class="p">(</span><span class="nx">r</span> <span class="o">?</span> <span class="nx">enc</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nx">r</span> <span class="o">-</span> <span class="mi">3</span><span class="p">)</span> <span class="o">:</span> <span class="nx">enc</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;===&#39;</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="nx">r</span> <span class="o">||</span> <span class="mi">3</span><span class="p">);</span></div><div class='line' id='LC449'><br/></div><div class='line' id='LC450'>		    <span class="c1">// end of base64 encoder MIT, GPL</span></div><div class='line' id='LC451'>		<span class="p">}</span></div><div class='line' id='LC452'>	<span class="p">}</span></div><div class='line' id='LC453'><br/></div><div class='line' id='LC454'>	<span class="kd">var</span> <span class="nx">unencodedmime</span> <span class="o">=</span> <span class="s1">&#39;image/svg+xml&#39;</span></div><div class='line' id='LC455'>	<span class="kd">function</span> <span class="nx">getUnencodedSVG</span><span class="p">(</span><span class="nx">data</span><span class="p">){</span></div><div class='line' id='LC456'>		<span class="k">return</span> <span class="p">[</span><span class="nx">unencodedmime</span> <span class="p">,</span> <span class="nx">compressstrokes</span><span class="p">(</span><span class="nx">data</span><span class="p">)]</span></div><div class='line' id='LC457'>	<span class="p">}</span></div><div class='line' id='LC458'><br/></div><div class='line' id='LC459'>	<span class="kd">var</span> <span class="nx">base64encodedmime</span> <span class="o">=</span> <span class="s1">&#39;image/svg+xml;base64&#39;</span></div><div class='line' id='LC460'>	<span class="kd">function</span> <span class="nx">getBase64encodedSVG</span><span class="p">(</span><span class="nx">data</span><span class="p">){</span></div><div class='line' id='LC461'>		<span class="k">return</span> <span class="p">[</span><span class="nx">base64encodedmime</span> <span class="p">,</span> <span class="nx">btoa</span><span class="p">(</span> <span class="nx">compressstrokes</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="p">)]</span> </div><div class='line' id='LC462'>	<span class="p">}</span> </div><div class='line' id='LC463'><br/></div><div class='line' id='LC464'>	<span class="kd">function</span> <span class="nx">Initializer</span><span class="p">(</span><span class="nx">$</span><span class="p">){</span></div><div class='line' id='LC465'>		<span class="kd">var</span> <span class="nx">mothership</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">fn</span><span class="p">[</span><span class="s1">&#39;jSignature&#39;</span><span class="p">]</span></div><div class='line' id='LC466'>		<span class="nx">mothership</span><span class="p">(</span></div><div class='line' id='LC467'>			<span class="s1">&#39;addPlugin&#39;</span></div><div class='line' id='LC468'>			<span class="p">,</span><span class="s1">&#39;export&#39;</span></div><div class='line' id='LC469'>			<span class="p">,</span><span class="s1">&#39;svg&#39;</span> <span class="c1">// alias</span></div><div class='line' id='LC470'>			<span class="p">,</span><span class="nx">getUnencodedSVG</span></div><div class='line' id='LC471'>		<span class="p">)</span></div><div class='line' id='LC472'>		<span class="nx">mothership</span><span class="p">(</span></div><div class='line' id='LC473'>			<span class="s1">&#39;addPlugin&#39;</span></div><div class='line' id='LC474'>			<span class="p">,</span><span class="s1">&#39;export&#39;</span></div><div class='line' id='LC475'>			<span class="p">,</span><span class="nx">unencodedmime</span> <span class="c1">// full name</span></div><div class='line' id='LC476'>			<span class="p">,</span><span class="nx">getUnencodedSVG</span></div><div class='line' id='LC477'>		<span class="p">)</span></div><div class='line' id='LC478'>		<span class="nx">mothership</span><span class="p">(</span></div><div class='line' id='LC479'>			<span class="s1">&#39;addPlugin&#39;</span></div><div class='line' id='LC480'>			<span class="p">,</span><span class="s1">&#39;export&#39;</span></div><div class='line' id='LC481'>			<span class="p">,</span><span class="s1">&#39;svgbase64&#39;</span> <span class="c1">// alias</span></div><div class='line' id='LC482'>			<span class="p">,</span><span class="nx">getBase64encodedSVG</span></div><div class='line' id='LC483'>		<span class="p">)</span></div><div class='line' id='LC484'>		<span class="nx">mothership</span><span class="p">(</span></div><div class='line' id='LC485'>			<span class="s1">&#39;addPlugin&#39;</span></div><div class='line' id='LC486'>			<span class="p">,</span><span class="s1">&#39;export&#39;</span></div><div class='line' id='LC487'>			<span class="p">,</span><span class="nx">base64encodedmime</span> <span class="c1">// full name</span></div><div class='line' id='LC488'>			<span class="p">,</span><span class="nx">getBase64encodedSVG</span></div><div class='line' id='LC489'>		<span class="p">)</span></div><div class='line' id='LC490'>	<span class="p">}</span></div><div class='line' id='LC491'><br/></div><div class='line' id='LC492'>	<span class="c1">//  //Because plugins are minified together with jSignature, multiple defines per (minified) file blow up and dont make sense</span></div><div class='line' id='LC493'>	<span class="c1">//	//Need to revisit this later.</span></div><div class='line' id='LC494'><br/></div><div class='line' id='LC495'>	<span class="k">if</span><span class="p">(</span><span class="k">typeof</span> <span class="nx">$</span> <span class="o">===</span> <span class="s1">&#39;undefined&#39;</span><span class="p">)</span> <span class="p">{</span><span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s2">&quot;We need jQuery for some of the functionality. jQuery is not detected. Failing to initialize...&quot;</span><span class="p">)}</span></div><div class='line' id='LC496'>	<span class="nx">Initializer</span><span class="p">(</span><span class="nx">$</span><span class="p">)</span></div><div class='line' id='LC497'><br/></div><div class='line' id='LC498'><span class="p">})();</span></div></pre></div>
          </td>
        </tr>
      </table>
  </div>

          </div>
        </div>
      </div>

      <a href="#jump-to-line" rel="facebox" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
      <div id="jump-to-line" style="display:none">
        <h2>Jump to Line</h2>
        <form accept-charset="UTF-8" class="js-jump-to-line-form">
          <input class="textfield js-jump-to-line-field" type="text">
          <div class="full-button">
            <button type="submit" class="classy">
              Go
            </button>
          </div>
        </form>
      </div>

    </div>
</div>

<div id="js-frame-loading-template" class="frame frame-loading large-loading-area" style="display:none;">
  <img class="js-frame-loading-spinner" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-128.gif?1347543528" height="64" width="64">
</div>


        </div>
      </div>
      <div class="context-overlay"></div>
    </div>

      <div id="footer-push"></div><!-- hack for sticky footer -->
    </div><!-- end of wrapper - hack for sticky footer -->

      <!-- footer -->
      <div id="footer">
  <div class="container clearfix">

      <dl class="footer_nav">
        <dt>GitHub</dt>
        <dd><a href="https://github.com/about">About us</a></dd>
        <dd><a href="https://github.com/blog">Blog</a></dd>
        <dd><a href="https://github.com/contact">Contact &amp; support</a></dd>
        <dd><a href="http://enterprise.github.com/">GitHub Enterprise</a></dd>
        <dd><a href="http://status.github.com/">Site status</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>Applications</dt>
        <dd><a href="http://mac.github.com/">GitHub for Mac</a></dd>
        <dd><a href="http://windows.github.com/">GitHub for Windows</a></dd>
        <dd><a href="http://eclipse.github.com/">GitHub for Eclipse</a></dd>
        <dd><a href="http://mobile.github.com/">GitHub mobile apps</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>Services</dt>
        <dd><a href="http://get.gaug.es/">Gauges: Web analytics</a></dd>
        <dd><a href="http://speakerdeck.com">Speaker Deck: Presentations</a></dd>
        <dd><a href="https://gist.github.com">Gist: Code snippets</a></dd>
        <dd><a href="http://jobs.github.com/">Job board</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>Documentation</dt>
        <dd><a href="http://help.github.com/">GitHub Help</a></dd>
        <dd><a href="http://developer.github.com/">Developer API</a></dd>
        <dd><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></dd>
        <dd><a href="http://pages.github.com/">GitHub Pages</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>More</dt>
        <dd><a href="http://training.github.com/">Training</a></dd>
        <dd><a href="https://github.com/edu">Students &amp; teachers</a></dd>
        <dd><a href="http://shop.github.com">The Shop</a></dd>
        <dd><a href="/plans">Plans &amp; pricing</a></dd>
        <dd><a href="http://octodex.github.com/">The Octodex</a></dd>
      </dl>

      <hr class="footer-divider">


    <p class="right">&copy; 2013 <span title="0.48107s from fe1.rs.github.com">GitHub</span> Inc. All rights reserved.</p>
    <a class="left" href="https://github.com/">
      <span class="mega-icon mega-icon-invertocat"></span>
    </a>
    <ul id="legal">
        <li><a href="https://github.com/site/terms">Terms of Service</a></li>
        <li><a href="https://github.com/site/privacy">Privacy</a></li>
        <li><a href="https://github.com/security">Security</a></li>
    </ul>

  </div><!-- /.container -->

</div><!-- /.#footer -->


    

    

<div id="keyboard_shortcuts_pane" class="instapaper_ignore readability-extra" style="display:none">
  <h2>Keyboard Shortcuts <small><a href="#" class="js-see-all-keyboard-shortcuts">(see all)</a></small></h2>

  <div class="columns threecols">
    <div class="column first">
      <h3>Site wide shortcuts</h3>
      <dl class="keyboard-mappings">
        <dt>s</dt>
        <dd>Focus command bar</dd>
      </dl>
      <dl class="keyboard-mappings">
        <dt>?</dt>
        <dd>Bring up this help dialog</dd>
      </dl>
    </div><!-- /.column.first -->

    <div class="column middle" style='display:none'>
      <h3>Commit list</h3>
      <dl class="keyboard-mappings">
        <dt>j</dt>
        <dd>Move selection down</dd>
      </dl>
      <dl class="keyboard-mappings">
        <dt>k</dt>
        <dd>Move selection up</dd>
      </dl>
      <dl class="keyboard-mappings">
        <dt>c <em>or</em> o <em>or</em> enter</dt>
        <dd>Open commit</dd>
      </dl>
      <dl class="keyboard-mappings">
        <dt>y</dt>
        <dd>Expand URL to its canonical form</dd>
      </dl>
    </div><!-- /.column.first -->

    <div class="column last js-hidden-pane" style='display:none'>
      <h3>Pull request list</h3>
      <dl class="keyboard-mappings">
        <dt>j</dt>
        <dd>Move selection down</dd>
      </dl>
      <dl class="keyboard-mappings">
        <dt>k</dt>
        <dd>Move selection up</dd>
      </dl>
      <dl class="keyboard-mappings">
        <dt>o <em>or</em> enter</dt>
        <dd>Open issue</dd>
      </dl>
      <dl class="keyboard-mappings">
        <dt><span class="platform-mac">⌘</span><span class="platform-other">ctrl</span> <em>+</em> enter</dt>
        <dd>Submit comment</dd>
      </dl>
      <dl class="keyboard-mappings">
        <dt><span class="platform-mac">⌘</span><span class="platform-other">ctrl</span> <em>+</em> shift p</dt>
        <dd>Preview comment</dd>
      </dl>
    </div><!-- /.columns.last -->

  </div><!-- /.columns.equacols -->

  <div class="js-hidden-pane" style='display:none'>
    <div class="rule"></div>

    <h3>Issues</h3>

    <div class="columns threecols">
      <div class="column first">
        <dl class="keyboard-mappings">
          <dt>j</dt>
          <dd>Move selection down</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>k</dt>
          <dd>Move selection up</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>x</dt>
          <dd>Toggle selection</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>o <em>or</em> enter</dt>
          <dd>Open issue</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt><span class="platform-mac">⌘</span><span class="platform-other">ctrl</span> <em>+</em> enter</dt>
          <dd>Submit comment</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt><span class="platform-mac">⌘</span><span class="platform-other">ctrl</span> <em>+</em> shift p</dt>
          <dd>Preview comment</dd>
        </dl>
      </div><!-- /.column.first -->
      <div class="column last">
        <dl class="keyboard-mappings">
          <dt>c</dt>
          <dd>Create issue</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>l</dt>
          <dd>Create label</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>i</dt>
          <dd>Back to inbox</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>u</dt>
          <dd>Back to issues</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>/</dt>
          <dd>Focus issues search</dd>
        </dl>
      </div>
    </div>
  </div>

  <div class="js-hidden-pane" style='display:none'>
    <div class="rule"></div>

    <h3>Issues Dashboard</h3>

    <div class="columns threecols">
      <div class="column first">
        <dl class="keyboard-mappings">
          <dt>j</dt>
          <dd>Move selection down</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>k</dt>
          <dd>Move selection up</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>o <em>or</em> enter</dt>
          <dd>Open issue</dd>
        </dl>
      </div><!-- /.column.first -->
    </div>
  </div>

  <div class="js-hidden-pane" style='display:none'>
    <div class="rule"></div>

    <h3>Network Graph</h3>
    <div class="columns equacols">
      <div class="column first">
        <dl class="keyboard-mappings">
          <dt><span class="badmono">←</span> <em>or</em> h</dt>
          <dd>Scroll left</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt><span class="badmono">→</span> <em>or</em> l</dt>
          <dd>Scroll right</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt><span class="badmono">↑</span> <em>or</em> k</dt>
          <dd>Scroll up</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt><span class="badmono">↓</span> <em>or</em> j</dt>
          <dd>Scroll down</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>t</dt>
          <dd>Toggle visibility of head labels</dd>
        </dl>
      </div><!-- /.column.first -->
      <div class="column last">
        <dl class="keyboard-mappings">
          <dt>shift <span class="badmono">←</span> <em>or</em> shift h</dt>
          <dd>Scroll all the way left</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>shift <span class="badmono">→</span> <em>or</em> shift l</dt>
          <dd>Scroll all the way right</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>shift <span class="badmono">↑</span> <em>or</em> shift k</dt>
          <dd>Scroll all the way up</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>shift <span class="badmono">↓</span> <em>or</em> shift j</dt>
          <dd>Scroll all the way down</dd>
        </dl>
      </div><!-- /.column.last -->
    </div>
  </div>

  <div class="js-hidden-pane" >
    <div class="rule"></div>
    <div class="columns threecols">
      <div class="column first js-hidden-pane" >
        <h3>Source Code Browsing</h3>
        <dl class="keyboard-mappings">
          <dt>t</dt>
          <dd>Activates the file finder</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>l</dt>
          <dd>Jump to line</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>w</dt>
          <dd>Switch branch/tag</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>y</dt>
          <dd>Expand URL to its canonical form</dd>
        </dl>
      </div>
    </div>
  </div>

  <div class="js-hidden-pane" style='display:none'>
    <div class="rule"></div>
    <div class="columns threecols">
      <div class="column first">
        <h3>Browsing Commits</h3>
        <dl class="keyboard-mappings">
          <dt><span class="platform-mac">⌘</span><span class="platform-other">ctrl</span> <em>+</em> enter</dt>
          <dd>Submit comment</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>escape</dt>
          <dd>Close form</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>p</dt>
          <dd>Parent commit</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>o</dt>
          <dd>Other parent commit</dd>
        </dl>
      </div>
    </div>
  </div>

  <div class="js-hidden-pane" style='display:none'>
    <div class="rule"></div>
    <h3>Notifications</h3>

    <div class="columns threecols">
      <div class="column first">
        <dl class="keyboard-mappings">
          <dt>j</dt>
          <dd>Move selection down</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>k</dt>
          <dd>Move selection up</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>o <em>or</em> enter</dt>
          <dd>Open notification</dd>
        </dl>
      </div><!-- /.column.first -->

      <div class="column second">
        <dl class="keyboard-mappings">
          <dt>e <em>or</em> shift i <em>or</em> y</dt>
          <dd>Mark as read</dd>
        </dl>
        <dl class="keyboard-mappings">
          <dt>shift m</dt>
          <dd>Mute thread</dd>
        </dl>
      </div><!-- /.column.first -->
    </div>
  </div>

</div>

    <div id="markdown-help" class="instapaper_ignore readability-extra">
  <h2>Markdown Cheat Sheet</h2>

  <div class="cheatsheet-content">

  <div class="mod">
    <div class="col">
      <h3>Format Text</h3>
      <p>Headers</p>
      <pre>
# This is an &lt;h1&gt; tag
## This is an &lt;h2&gt; tag
###### This is an &lt;h6&gt; tag</pre>
     <p>Text styles</p>
     <pre>
*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__

*You **can** combine them*
</pre>
    </div>
    <div class="col">
      <h3>Lists</h3>
      <p>Unordered</p>
      <pre>
* Item 1
* Item 2
  * Item 2a
  * Item 2b</pre>
     <p>Ordered</p>
     <pre>
1. Item 1
2. Item 2
3. Item 3
   * Item 3a
   * Item 3b</pre>
    </div>
    <div class="col">
      <h3>Miscellaneous</h3>
      <p>Images</p>
      <pre>
![GitHub Logo](/images/logo.png)
Format: ![Alt Text](url)
</pre>
     <p>Links</p>
     <pre>
http://github.com - automatic!
[GitHub](http://github.com)</pre>
<p>Blockquotes</p>
     <pre>
As Kanye West said:

> We're living the future so
> the present is our past.
</pre>
    </div>
  </div>
  <div class="rule"></div>

  <h3>Code Examples in Markdown</h3>
  <div class="col">
      <p>Syntax highlighting with <a href="http://github.github.com/github-flavored-markdown/" title="GitHub Flavored Markdown" target="_blank">GFM</a></p>
      <pre>
```javascript
function fancyAlert(arg) {
  if(arg) {
    $.facebox({div:'#foo'})
  }
}
```</pre>
    </div>
    <div class="col">
      <p>Or, indent your code 4 spaces</p>
      <pre>
Here is a Python code example
without syntax highlighting:

    def foo:
      if not bar:
        return true</pre>
    </div>
    <div class="col">
      <p>Inline code for comments</p>
      <pre>
I think you should use an
`&lt;addr&gt;` element here instead.</pre>
    </div>
  </div>

  </div>
</div>


    <div id="ajax-error-message" class="flash flash-error">
      <span class="mini-icon mini-icon-exclamation"></span>
      Something went wrong with that request. Please try again.
      <a href="#" class="mini-icon mini-icon-remove-close ajax-error-dismiss"></a>
    </div>

    
    
    <span id='server_response_time' data-time='0.48234' data-host='fe1'></span>
    
  </body>
</html>

