1 <canvas id=
"canvas" width=
"200" height=
"100"></canvas>
4 testRunner
.dumpAsTextWithPixelResults();
7 // This is a 2x1 image, blue at (0, 0) and green at (1, 0).
8 img
.src
= 'data:image/png;base64,' +
9 'iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAIAAAB7QOjdAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAA' +
10 'CxMBAJqcGAAAAAd0SU1FB9wIGxQKIbPpHtMAAAAPSURBVAjXY2Bg+M/wnwEABgEB/6KPEdkAAAAASUVO' +
13 img
.onload = function()
15 // Start from the middle of the blue pixel and stretch to the entire
16 // canvas. Canvas should have 1/3 blue on the left and 2/3 green on the
17 // right, with gradient if interpolation allows.
18 var ctx
= document
.getElementById("canvas").getContext("2d");
19 ctx
.drawImage(img
, 0.5, 0, 1.5, 1, 0, 0, 200, 100);