Permalink
Browse files

Added documentation

  • Loading branch information...
meltingice committed Apr 9, 2013
1 parent 20b7213 commit 731f7849c7f9dbf2eb3cc9357fa7655cd159c288
Showing with 132 additions and 48 deletions.
  1. +88 −44 docs/caman.html
  2. +20 −2 docs/logger.html
  3. +1 −1 docs/renderer.html
  4. +19 −1 docs/util.html
  5. +3 −0 src/core/caman.coffee
  6. +1 −0 src/core/util.coffee
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -181,9 +181,27 @@ <h1>logger.coffee</h1>
<span class="nv">constructor: </span><span class="o">-&gt;</span>
<span class="k">for</span> <span class="nx">name</span> <span class="k">in</span> <span class="p">[</span><span class="s">&#39;log&#39;</span><span class="p">,</span> <span class="s">&#39;info&#39;</span><span class="p">,</span> <span class="s">&#39;warn&#39;</span><span class="p">,</span> <span class="s">&#39;error&#39;</span><span class="p">]</span>
<span class="nx">@</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span> <span class="o">=</span> <span class="nx">do</span> <span class="nf">(name) -&gt;</span>
- <span class="o">-&gt;</span>
+ <span class="nf">(args...) -&gt;</span>
<span class="k">return</span> <span class="k">if</span> <span class="o">not</span> <span class="nx">Caman</span><span class="p">.</span><span class="nx">DEBUG</span>
- <span class="nx">console</span><span class="p">[</span><span class="nx">name</span><span class="p">].</span><span class="nx">apply</span> <span class="nx">console</span><span class="p">,</span> <span class="nx">arguments</span>
+ <span class="k">try</span>
+ <span class="nx">console</span><span class="p">[</span><span class="nx">name</span><span class="p">].</span><span class="nx">apply</span> <span class="nx">console</span><span class="p">,</span> <span class="nx">args</span>
+ <span class="k">catch</span> <span class="nx">e</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-2">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-2">&#182;</a>
+ </div>
+
+<p>We&#39;re probably using IE9 or earlier</p>
+
+ </div>
+
+ <div class="content"><div class="highlight"><pre> <span class="nx">console</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span> <span class="nx">args</span>
<span class="vi">@debug = </span><span class="nx">@log</span>
View
@@ -262,7 +262,7 @@ <h1>renderer.coffee</h1>
<span class="nv">execute: </span><span class="nf">(callback) -&gt;</span>
<span class="vi">@finishedFn = </span><span class="nx">callback</span>
- <span class="vi">@modPixelData = </span><span class="k">new</span> <span class="nx">Uint8Array</span><span class="p">(</span><span class="nx">@c</span><span class="p">.</span><span class="nx">pixelData</span><span class="p">.</span><span class="nx">length</span><span class="p">)</span>
+ <span class="vi">@modPixelData = </span><span class="nx">Util</span><span class="p">.</span><span class="nx">dataArray</span><span class="p">(</span><span class="nx">@c</span><span class="p">.</span><span class="nx">pixelData</span><span class="p">.</span><span class="nx">length</span><span class="p">)</span>
<span class="nx">@processNext</span><span class="p">()</span>
View
@@ -265,7 +265,25 @@ <h1>util.coffee</h1>
<span class="vi">@copyAttributes: </span><span class="nf">(from, to, opts={}) -&gt;</span>
<span class="k">for</span> <span class="nx">attr</span> <span class="k">in</span> <span class="nx">from</span><span class="p">.</span><span class="nx">attributes</span>
<span class="k">continue</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">except</span><span class="o">?</span> <span class="o">and</span> <span class="nx">attr</span><span class="p">.</span><span class="nx">nodeName</span> <span class="k">in</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">except</span>
- <span class="nx">to</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="nx">attr</span><span class="p">.</span><span class="nx">nodeName</span><span class="p">,</span> <span class="nx">attr</span><span class="p">.</span><span class="nx">nodeValue</span><span class="p">)</span>
+ <span class="nx">to</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="nx">attr</span><span class="p">.</span><span class="nx">nodeName</span><span class="p">,</span> <span class="nx">attr</span><span class="p">.</span><span class="nx">nodeValue</span><span class="p">)</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-6">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-6">&#182;</a>
+ </div>
+
+<p>Support for browsers that don&#39;t know Uint8Array (such as IE9)</p>
+
+ </div>
+
+ <div class="content"><div class="highlight"><pre> <span class="vi">@dataArray: </span><span class="nf">(length = 0) -&gt;</span>
+ <span class="k">return</span> <span class="k">new</span> <span class="nx">Uint8Array</span><span class="p">(</span><span class="nx">length</span><span class="p">)</span> <span class="k">if</span> <span class="nx">Caman</span><span class="p">.</span><span class="nx">NodeJS</span> <span class="o">or</span> <span class="nb">window</span><span class="p">.</span><span class="nx">Uint8Array</span><span class="o">?</span>
+ <span class="k">return</span> <span class="k">new</span> <span class="nb">Array</span><span class="p">(</span><span class="nx">length</span><span class="p">)</span>
</pre></div></div>
View
@@ -258,6 +258,9 @@ Root.Caman = class Caman
return false if @image.naturalWidth? and @image.naturalWidth is 0
return true
+ # Internet Explorer has issues figuring out image dimensions when they aren't
+ # explicitly defined apparently. We check the normal width/height properties first,
+ # but fall back to natural sizes if they are 0.
imageWidth: -> @image.width or @image.naturalWidth
imageHeight: -> @image.height or @image.naturalHeight
View
@@ -36,6 +36,7 @@ class Util
continue if opts.except? and attr.nodeName in opts.except
to.setAttribute(attr.nodeName, attr.nodeValue)
+ # Support for browsers that don't know Uint8Array (such as IE9)
@dataArray: (length = 0) ->
return new Uint8Array(length) if Caman.NodeJS or window.Uint8Array?
return new Array(length)

0 comments on commit 731f784

Please sign in to comment.