title: Html5 canvas hittest arbitrary shape
body: <p>I'm trying to develop program which can render images and text in canvas. I tried to handle click on image in canvas, but it work for rectable images. </p>
  
  <p><strong>My question:</strong> Did you know solution or frameworks for handle click on visible part of image (not transparent part) in canvas ?</p>
  
  <p>I'm looking for javascript implementation of ActionScript hitTestObject function, if someone familiar with it.</p>
  
  <p>Here is simple algorithm with rectable hit text: <a href="http://jsfiddle.net/V92Gn/298/" rel="nofollow">http://jsfiddle.net/V92Gn/298/</a></p>
  
  <pre><code>var hitted = e.clientX &gt;= position.x &amp;&amp; 
      e.clientX &lt;= position.x + logoImg.width &amp;&amp; 
      e.clientY &gt;= position.y &amp;&amp; 
      e.clientY &lt;= position.y + logoImg.height;
  </code></pre>