// 绘制二维码
ctx.save(); // 先保存状态 已便于画完圆再用
ctx.beginPath(); //开始绘制
ctx.arc(100, 100, 100, 0, Math.PI * 2, false);//先画个圆
ctx.clip();//画了圆 再剪切
ctx.drawImage(_this.data.code,_this.data.codex,_this.data.codey,200,200);// 推进去图片
ctx.restore();//恢复之前保存的绘图上下文
网友评论