绘制图像,图像保持原始尺寸。
参数 | 类型 | 说明 |
---|---|---|
imageresource | string | 所要绘制的图片资源 |
x | number | 图像左上角的x坐标 |
y | number | 图像左上角的y坐标 |
width | number | 图像宽度 |
height | number | 图像高度 |
const ctx = wx.createcanvascontext('mycanvas')
wx.chooseimage({
success: function(res){
ctx.drawimage(res.tempfilepaths[0], 0, 0, 150, 100)
ctx.draw()
}
})