canvas-1b.xhtml 939 B

12345678910111213141516171819202122232425262728
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <svg xmlns="http://www.w3.org/2000/svg"
  3. xmlns:xlink="http://www.w3.org/1999/xlink"
  4. version="1.1">
  5. <!-- use an empty g to force filters.svg to load before onload -->
  6. <use xlink:href="../filters.svg#empty" />
  7. <foreignObject filter="url(../filters.svg#ThresholdRGB)" x="0" y="0" height="100%" width="100%">
  8. <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  9. <body>
  10. <canvas id="canvas" width="200" height="200"></canvas>
  11. <script>
  12. function draw() {
  13. var video = document.getElementById("video");
  14. var canvas = document.getElementById("canvas");
  15. var ctx = canvas.getContext("2d");
  16. try {
  17. ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
  18. } catch (e) {
  19. }
  20. document.documentElement.removeAttribute("class");
  21. }
  22. </script>
  23. <video id="video" src="black140x100.ogv" onloadeddata="draw()" style="opacity:0"></video>
  24. </body>
  25. </html>
  26. </foreignObject>
  27. </svg>