fail canvas is empty

发布于 6 年前作者 guiying856935 次浏览最后编辑 6 年前来自 ask

代码:

var res = wx.getSystemInfoSync();

const ctx = wx.createCanvasContext(‘myCanvas’);

ctx.drawImage(‘…/…/resource/img/dlt.jpeg’, 0, 0, res.windowWidth, res.windowHeight);

ctx.draw();

wx.canvasToTempFilePath({

x: 100,

y: 200,

width: 50,

height: 50,

destWidth: 100,

destHeight: 100,

canvasId: ‘myCanvas’,

success: function (res) {

console.log(res.tempFilePath)

},

fail: function (e) {

console.log(e);

}

})

图片可以画出来,但是保存的时候输出:fail canvas is empty,这是什么原因?

3 回复
dinglei
dinglei1 楼6 年前

碰到同样的问题

yongliang
yongliang2 楼6 年前

这个问题到现在还没解决吗?

hanjie
hanjie3 楼4 年前

你好,这是一个已知问题,我们会尽快进行修复。另外后续建议通过搜索相关关键字来后在提问,可以提高问题解答的效率。