tor-browser

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

canvas-drawImage-scale-1b.html (896B)


      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          // Note that our canvas is 100x100, so our scaled 200x200 image will
     16          // get cropped to 100x100.
     17          ctx.scale(2, 2);  // Scale our image-drawing by 2
     18          ctx.drawImage(image, 0, 0);
     19          document.documentElement.removeAttribute("class");
     20        }
     21        image.src ="lime100x100.svg";
     22      }
     23    </script>
     24  </head>
     25  <body onload="go()">
     26    <canvas id="canvas" width="100" height="100"></canvas>
     27 </body>
     28 </html>