微信6.6.7 小程序Cavas clip方法连续裁剪图片时,只有第一张有效
发布于 4 年前 作者 syuan 14464 次浏览 来自 问答

微信版本6.6.7, 小程序 canvas clip方法裁剪图片只有第一张会裁剪,后续图片都无法裁剪。

3 回复

你好,麻烦提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html?search-key=%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5)和机型

我本地iphone5 ,iphone6s 都有这个问题

我也遇到了。

const ctx = wx.createCanvasContext('testCanvas')
        wx.downloadFile({
          url: 'https://cdn.maoka777.com/1519739243_b45291.png?imageMogr2/thumbnail/200x/interlace/1',
          success: function(res) {
              ctx.save()
              ctx.beginPath()
              ctx.arc(283, 75.5, 50, 0, 2*Math.PI) 
              ctx.clip() 
              ctx.drawImage(res.tempFilePath, 233, 25.5, 100, 100)
              ctx.restore()
 
              ctx.save()     
              ctx.beginPath()
              ctx.arc(50, 50, 25, 0, 2*Math.PI)
              ctx.clip()
              ctx.drawImage(res.tempFilePath, 25, 25)
              ctx.restore()
 
              ctx.draw()
          }
        })
回到顶部