[英]save canvas drawing as data or image for later insertion into html page
A Meteor client code renders a template with canvas
for client signature. 流星客户端代码使用canvas
渲染用于客户端签名的模板。 It listens on mousemove
and draws lines between mouse x,y coordinates of one point to another as it moves, using context.stroke()
. 它侦听mousemove
并使用context.stroke()
在鼠标移动的一点与另一点的x,y坐标之间绘制线条。
How can the signature be saved and inserted in html page later? 以后如何保存签名并将其插入html页面? ie data or image would be best practice? 即数据或图像将是最佳做法? Thanks 谢谢
Use a variable 使用变量
var image = ctx.getImageData(0,0,width,height);
To put it back when you need it: 在需要时将其放回原位:
ctx.putImageData(imgdata, 0,0);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.