Javascript examples for Canvas Reference:getImageData
Add outer shadow to Canvas
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from www. j a va2s . c o m*/ var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.shadowColor = 'black'; ctx.shadowBlur = 15; var imgdata = ctx.getImageData(20, 30, 150, 75); ctx.strokeRect(20, 30, 150, 75); ctx.putImageData(imgdata, 20, 30); } </script> </head> <body> <canvas id="myCanvas"></canvas> </body> </html>