Code
Execute
<!DOCTYPE html> <html> <head> <title>wikitechy-isPointInPath() Method</title> </head> <body> <h1>wikitechy-isPointInPath() Method</h1> <canvas id="wikitechyCanvas" width="300" height="150" style="border:1px solid #d3d3d3;"> </canvas> <script> var canvas = document.getElementById("wikitechyCanvas"); var context = canvas.getContext("2d"); context.rect(20, 20, 150, 100); if (context.isPointInPath(20, 50)) { context.stroke(); }; </script> </body> </html>
Result