// 绘制头像
const radius = rpx2px(90 * 2)
const y = rpx2px(120 * 2)
ctx.save()
ctx.beginPath()
ctx.arc(canvasW / 2, y - radius + radius, radius, 0, Math.PI * 2, false);
ctx.stroke()//这个一定要有 不然图片不裁剪
ctx.clip()
ctx.drawImage(avatar.path, canvasW / 2 - radius, y - radius, radius * 2, radius * 2);
ctx.restore()
图片大小根据ui比例设置 save stroke clip restore 就能画出来