wx.canvasGetImageData方法有bug??

发布于 7 年前作者 caojuan6364 次浏览最后编辑 7 年前来自 ask
  1. 调用drawImage画图后。

  2. 再调用wx.canvasGetImageData方法未能获取canvas画图后的最新像素数据??

源码如下:

context.drawImage(res.tempFilePath, 0, 0, 210, 178);

context.draw(true, function (e) {

wx.canvasGetImageData({

canvasId: ‘photoCanvasqq’,

x: 0,

y: 0,

width: 210,

height: 178,

success(res) {

console.log(res.width)

console.log(res.height)

console.log(res.data instanceof Uint8ClampedArray)

console.log(res.data.length)

console.log(res.data);//返回的像素数据不是最新的canvas画图后的像素数据??

}, fail(res) {

console.log(‘error:’+res)

}

})

});

2 回复
tianguiying
tianguiying1 楼6 年前

就是当前的canvas的像素数据。 这里你是怎么判断不是最新的?

jie27
jie272 楼5 年前

wx.canvasGetImageData真机读取的数据失真,怎么解决?