Here's how to use context.getImageData to test if the pixel under the mouse is black or white:
The key is to get the image pixel array and test if any of the red, green or blue components are near 255 (==white if all rgb equal 255)
Example code and a Demo: http://jsfiddle.net/m1erickson/Uw3A4/
var canvas=document.getElementById("canvas");
var ctx=canvas.getContext("2d");
var $canvas=$("#canvas");
var canvasOffset=$canvas.offset();
var offsetX=canvasOffset.left;
var offsetY=canvasOffset.top;
var data;
var $results=$("#results");
var img=new Image();
img.onload=start;
img.crossOrigin="anonymous";
img.src="https://dl.dropboxusercontent.com/u/139992952/multple/temp00.png";
function start(){
canvas.width=img.width;
canvas.height=img.height;
ctx.drawImage(img,0,0);
data=ctx.getImageData(0,0,canvas.width,canvas.height).data;
}
function handleMouseMove(e){
e.preventDefault();
e.stopPropagation();
mouseX=parseInt(e.clientX-offsetX);
mouseY=parseInt(e.clientY-offsetY);
var isWhite=(data[(mouseY*canvas.width+mouseX)*4]>200);
$results.text(isWhite?"Inside":"Outside");
}
$("#canvas").mousemove(function(e){handleMouseMove(e);});