555388-1.html (737B)
1 <html> 2 <head> 3 <script type="application/javascript"> 4 function draw() { 5 var canvas = document.getElementById("canvas"); 6 var ctx = canvas.getContext("2d"); 7 8 ctx.fillStyle = "red"; 9 ctx.fillRect(0, 0, 500, 500); 10 ctx.save(); 11 ctx.beginPath(); 12 ctx.moveTo(30, 30); 13 ctx.lineTo(149, 30); 14 ctx.lineTo(150, 150); 15 ctx.lineTo(30, 150); 16 ctx.lineTo(30, 30); 17 ctx.clip(); 18 ctx.clearRect(0, 0, 500, 500); 19 /** 20 * Work around a strange left edge offset problem in D2D. 21 */ 22 ctx.restore(); 23 ctx.fillStyle = "red"; 24 ctx.fillRect(0, 0, 1, 500); 25 ctx.fillStyle = "white"; 26 ctx.fillRect(30, 30, 1, 120); 27 } 28 </script> 29 </head> 30 <body onload="draw()"> 31 <canvas id="canvas" width="300" height="300"></canvas> 32 </body> 33 </html>