2 <head><meta charset=
"utf-8"></head>
4 <canvas id=
"canvas" width=
"100" height=
"100" style=
"background-color: #555555;"></canvas>
6 let canvas
= document
.getElementById("canvas");
7 let ctx
= canvas
.getContext("2d");
9 const canvasTemp
= document
.createElement('canvas');
10 canvasTemp
.width
= 50;
11 canvasTemp
.height
= 50;
12 let ctxTemp
= canvasTemp
.getContext("2d");
13 ctxTemp
.fillStyle
= "#ff0000";
14 ctxTemp
.fillRect(0, 0, 50, 50);
15 ctxTemp
.fillStyle
= "#00ff00";
16 ctxTemp
.fillRect(2, 2, 46, 46);
17 ctx
.drawImage(canvasTemp
, -25, -25, 100, 100, -25, -25, 100, 100);