title: Canvas get touch events for images
body: <p>I'm writing a little 2D android game based on the <code>SurfaceView</code> Object, so I draw my whole game on a <code>canvas</code>. I designed a ball as a <code>png</code> and draw it on the canvas with this method:</p>
  
  <pre><code>canvas.drawBitmap(bmp, posX, posY, null);
  </code></pre>
  
  <p>Now my problem is that I do not know how I can receive touch events for this ball. My png is 64x64 pixel but the ball is only 32x32 pixel and in the middle of the image. I only want to receive touch events if the ball (32x32) is touched and not the bitmap (64x64). How can I do this? I can register an <code>OnTouchListener</code> for the <code>SurfaceView</code> but how can I detect the ball touch? </p>
  
  <p>An other problem is that a ball is a simple object. What if I have some unregular objects which are not describeable through a radius or something else? Do I use the right "technology" with pngs at all for building controls for a canvas or is there a better/easier way? </p>
  
  <p>That is a typical problem for me on all platforms (JS, Android, iOS) and I do not know the best way to solve it. That's why I used some other tags for this question. Isn't there a cross-platform solution so I can solve this problem forever?</p>