![](/img/trans.png)
[英]Why can't I use a javascript function to paint more than one image on an html canvas?
[英]How can I retrieve a canvas image and use that image in a function all within one javaScript onClick event?
这是我希望将画布图像检索到@ img.src中的功能。
function draw() {
img = new Image();
img.src = [user defined canvas image].png
fr1 = makeFrame(ctx,makeVect(400,0),makeVect(400,makeVect(0, 400));
img.onload = function(){ //<< This Im not sure of <<<
ctx.save();
newPainter = cornerSplit(imagePainter,5);
newPainter(fr1);
ctx.restore();
ctx.save();
newPainter(flipHorizLeft(fr1));
ctx.restore();
ctx.save();
newPainter(flipVertDown(fr1));
ctx.restore();
ctx.save();
newPainter(flipVertDown(flipHorizLeft(fr1)));
}
}
从中检索图像的画布是:“ canvas2”,其上下文是“ context2”,其HTML句柄是“ imageCreate”
由于您措辞的方式,很难弄清楚您想要的是什么。 假设我猜对了,您希望document.getElementById(“ canvas2”)。toDataURL(“ image / png”)捕获画布的图像数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.