nonzero-fill-2.html 547 B

123456789101112131415161718192021222324252627
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. window.onload = function() {
  5. var ctx = document.getElementById("c1").getContext("2d");
  6. ctx.moveTo(50, 50);
  7. ctx.lineTo(250, 50);
  8. ctx.lineTo(250, 250);
  9. ctx.lineTo(50, 250);
  10. ctx.lineTo(50, 50);
  11. ctx.moveTo(100, 100);
  12. ctx.lineTo(100, 200);
  13. ctx.lineTo(200, 200);
  14. ctx.lineTo(200, 100);
  15. ctx.lineTo(100, 100);
  16. ctx.fill();
  17. }
  18. </script>
  19. </head>
  20. <body>
  21. <div><canvas id="c1" width="300" height="300"></canvas></div>
  22. </body>
  23. </html>