canvas-1a.xhtml 964 B

123456789101112131415161718192021222324252627282930
  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" class="reftest-wait">
  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. var video = document.createElement("video");
  13. video.src = "black140x100.ogv";
  14. video.load();
  15. function draw() {
  16. var canvas = document.getElementById("canvas");
  17. var ctx = canvas.getContext("2d");
  18. try {
  19. ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
  20. } catch (e) {
  21. }
  22. document.documentElement.removeAttribute("class");
  23. }
  24. video.addEventListener("loadeddata", draw, false);
  25. </script>
  26. </body>
  27. </html>
  28. </foreignObject>
  29. </svg>