JSFiddle - React, Tailwind, and code Playground
by loktar
HTML
<canvas id="canvas"></canvas>
JavaScript
var canvas = document.getElementById("canvas"),
ctx = canvas.getContext("2d");
canvas.width = canvas.height = 400;
ctx.fillStyle = "red";
ctx.fillRect(0,0,50,50);
ctx.fillStyle = "blue";
ctx.fillRect(10,10,30,30);
var imageData = ctx.getImageData(0,0,50,50);
ctx.putImageData(imageData,50,50,10,10,40,40);