Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (17 sloc) 8.591 kB
<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="analyze.html"> </a> <a class="source" href="blender.html"> </a> <a class="source" href="calculate.html"> </a> <a class="source" href="caman.html"> </a> <a class="source" href="camaninstance.html"> </a> <a class="source" href="convert.html"> </a> <a class="source" href="event.html"> </a> <a class="source" href="filter.html"> </a> <a class="source" href="io.html"> </a> <a class="source" href="layer.html"> </a> <a class="source" href="logger.html"> </a> <a class="source" href="pixelinfo.html"> </a> <a class="source" href="plugin.html"> </a> <a class="source" href="renderjob.html"> </a> <a class="source" href="store.html"> </a> <a class="source" href="util.html"> </a> <a class="source" href="blenders.html"> </a> <a class="source" href="filters.html"> </a> <a class="source" href="blur.html"> </a> <a class="source" href="camera.html"> </a> <a class="source" href="compoundBlur.html"> </a> <a class="source" href="edges.html"> </a> <a class="source" href="posterize.html"> </a> <a class="source" href="presets.html"> </a> <a class="source" href="size.html"> </a> <a class="source" href="stackBlur.html"> </a> <a class="source" href="threshold.html"> </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Look what you make me do Javascript</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">slice = </span><span class="nb">Array</span><span class="o">::</span><span class="nx">slice</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>DOM simplifier (no jQuery dependency)</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">$ = </span><span class="nf">(sel, root = document) -&gt;</span>
<span class="k">return</span> <span class="nx">sel</span> <span class="k">if</span> <span class="k">typeof</span> <span class="nx">sel</span> <span class="o">is</span> <span class="s2">&quot;object&quot;</span>
<span class="nx">root</span><span class="p">.</span><span class="nx">querySelector</span> <span class="nx">sel</span>
<span class="k">class</span> <span class="nx">Util</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>Unique value utility</p> </td> <td class="code"> <div class="highlight"><pre> <span class="vi">@uniqid = </span><span class="nx">do</span> <span class="o">-&gt;</span>
<span class="nv">id = </span><span class="mi">0</span>
<span class="nv">get: </span><span class="o">-&gt;</span> <span class="nx">id</span><span class="o">++</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>Helper function that extends one object with all the properies of other objects</p> </td> <td class="code"> <div class="highlight"><pre> <span class="vi">@extend = </span><span class="nf">(obj) -&gt;</span>
<span class="nv">dest = </span><span class="nx">obj</span>
<span class="nv">src = </span><span class="nx">slice</span><span class="p">.</span><span class="nx">call</span> <span class="nx">arguments</span><span class="p">,</span> <span class="mi">1</span>
<span class="k">for</span> <span class="nx">copy</span> <span class="k">in</span> <span class="nx">src</span>
<span class="k">for</span> <span class="nx">own</span> <span class="nx">prop</span> <span class="k">of</span> <span class="nx">copy</span>
<span class="nx">dest</span><span class="p">[</span><span class="nx">prop</span><span class="p">]</span> <span class="o">=</span> <span class="nx">copy</span><span class="p">[</span><span class="nx">prop</span><span class="p">]</span>
<span class="k">return</span> <span class="nx">dest</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>In order to stay true to the latest spec, RGB values must be clamped between
0 and 255. If we don't do this, weird things happen.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="vi">@clampRGB = </span><span class="nf">(val) -&gt;</span>
<span class="k">return</span> <span class="mi">0</span> <span class="k">if</span> <span class="nx">val</span> <span class="o">&lt;</span> <span class="mi">0</span>
<span class="k">return</span> <span class="mi">255</span> <span class="k">if</span> <span class="nx">val</span> <span class="o">&gt;</span> <span class="mi">255</span>
<span class="nx">val</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
Jump to Line
Something went wrong with that request. Please try again.