<!DOCTYPE html>
<html>
<body>
<svg style="display: block; width: 0; height: 0">
  <defs>
    <filter id="drop-shadow">
      <feGaussianBlur in="SourceAlpha" stdDeviation="0"/>
      <feOffset dx="0" dy="10" result="offsetblur"/>
      <feFlood flood-color="rgba(0,0,0,1)"/>
      <feComposite in2="offsetblur" operator="in"/>
      <feMerge>
        <feMergeNode/>
        <feMergeNode in="SourceGraphic"/>
      </feMerge>
    </filter>
  </defs>
</svg>
<canvas id="canvas" width="100" height="100"></canvas>
<script>

var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');

ctx.filter = 'url(#drop-shadow)';
ctx.fillStyle = '#0f0';
ctx.fillRect(25, 25, 50, 40);

</script>
</body>
</html>
