收藏
回答

canvas.clip编辑器调试没问题,真机运行报错

const ctx = wx.createCanvasContext('myCanvas');

var that = this;

wx.chooseImage({

count: 1, // 默认9

sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有

sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有

success: function (res) {

that.setData({

isMod: false,

isCut: true,

bgColor: "black",

tempFilePaths:res.tempFilePaths[0]

})

var tempFilePaths = res.tempFilePaths[0];

wx.getSystemInfo({

success: function (res) {

that.setData({

width: res.windowWidth,

height: res.windowHeight,

lastX: res.windowWidth * 0.23,

lastY: 0

})

}

})

ctx.save()

ctx.beginPath()

ctx.setFillStyle('white');

ctx.fillRect(that.data.width * 0.1, 30, that.data.width * 0.8, that.data.height * 0.3);

ctx.clip();

ctx.drawImage(that.data.tempFilePaths, that.data.width * 0.23, 0, 200, 300)

ctx.restore()

ctx.draw();

}

})


回答关注问题邀请回答
收藏

1 个回答

  • 黄思程
    黄思程
    2017-11-13

    请提供一下完整的代码。上面的代码片段没看到该log

    2017-11-13
    有用
    回复
登录 后发表内容