4
I’m using the following code
var canvas = document.createElement("canvas");
canvas.width = 55;
canvas.height = 20;
var ctx = canvas.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(0, 0, 100, 100);
var img = document.createElement("img");
img.src = canvas.toDataURL("image/png");
document.body.appendChild(img);
It generates a red 55x20 px rectangle. But I would like to put a text within this.
I tried to fillText();
but with no results.
Some help ?