CanvasContext.clip()对图片切圆处理,在真机上不显示,用rect矩形切图却可以?
发布于 7 年前 作者 dengyang 14462 次浏览 来自 官方Issues
wx.getImageInfo({
      src: data.user.headLogo,
      success(res) {
        console.log(res)
        ctx.save(); // 先保存状态 已便于画完圆再用
        ctx.beginPath(); //开始绘制
        //先画个圆
        ctx.arc( imgSize1/2, imgSize1/2, imgSize1/2, Math.PI * 2, false);
        ctx.clip();
        ctx.drawImage(res.path, 0 , 0 , imgSize1, imgSize1);
        ctx.restore();
        ctx.draw(true);
      }
    })
1 回复

是要做啥功能

回到顶部