7 var c
= document
.getElementById('c').getContext('2d');
10 c
.fillRect(0, 0, 100, 50);
12 var imgdata
= c
.createImageData(60, 50);
13 for (var i
= 0; i
< imgdata
.data
.length
; i
+= 4 * 60) {
14 for (var x
= i
; x
< i
+ 4 * 30; x
+= 4) {
15 imgdata
.data
[x
] = 255;
16 imgdata
.data
[x
+3] = 255;
18 for (var x
= i
+ 4 * 30; x
< i
+ 4 * 60; x
+= 4) {
19 imgdata
.data
[x
+2] = 255;
20 imgdata
.data
[x
+3] = 255;
24 // Verify that putImageData is not affected by the current transform.
26 c
.putImageData(imgdata
, 40, 0);
30 <body onload=
"draw();">
31 <canvas id='c' width='
100' height='
50'
></canvas>