tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

canvas-drawImage-slice-1a.html (945B)


      1 <html class="reftest-wait">
      2  <head>
      3    <script type="text/javascript">
      4      function go() {
      5        var canvas = document.getElementById("canvas");
      6        var ctx = canvas.getContext("2d");
      7 
      8        // Draw some orange
      9        ctx.fillStyle = "orange";
     10        ctx.fillRect(0, 0, 100, 100);
     11 
     12        // Instantiate an image. Once it has loaded, draw it & take snapshot.
     13        var image = new Image();
     14        image.onload = function() {
     15          // This version of the test is "easier", in that the sampled region
     16          // is offset from the red by 1px on all sides. This lets us avoid
     17          // any pixel-rounding errors.
     18          ctx.drawImage(image, 26, 26, 48, 48, 0, 0, 100, 100);
     19          document.documentElement.removeAttribute("class");
     20        }
     21        image.src ="limeInRed100x100.svg";
     22      }
     23    </script>
     24  </head>
     25  <body onload="go()">
     26    <canvas id="canvas" width="100" height="100"></canvas>
     27 </body>
     28 </html>