Is it possible to assign a function as the value of a canvas element? Here is my current implementation(non-working).
function recImagePressed(e){
var outputCanvas = document.getElementById("outputCanvas");
outputCanvas.value = draw();//-----this is my concern.
function draw() {
img = new Image();
img.src = canvas2.getContext();
fr1 = makeFrame(context2, makeVect(100,100), makeVect(200, 50), makeVect(50, 200));
img.onload = function(){
var newPainter = imagePainter(fr1);
context2.save();
}
}
Well, you can’t do that as you’re doing it. You also can’t do:
That won’t work. But you don’t need to do that because you can draw one canvas to another with
drawImage(canvas, x, y)You need to something similar to:
Depending on how you want to rotate and scale the image that is on canvas2 before drawing it to outputCanvas