【反馈bug】canvas 剪切图片bug
发布于 7 年前 作者 xiongmin 3978 次浏览 来自 问答

用canvas 将图片剪切成圆形,在工具预览显示为方形,手机上显示正常

ctx.save();

ctx.beginPath()

ctx.arc(50, 50, 25, 0, 2 * Math.PI);

ctx.setStrokeStyle(’#ffffff’)

ctx.clip();

ctx.drawImage(res[0].path, 25, 25, 50, 50);

ctx.stroke();

ctx.closePath();

ctx.restore();

1 回复

我也遇到了,纠结了半天。看到你说的真机上正常,果断去试了下,确实真机可以,那就先这样了

回到顶部