Skip to content

Instantly share code, notes, and snippets.

@zhangkn
Created May 25, 2018 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangkn/00ef54ed416e24511551706e54b66008 to your computer and use it in GitHub Desktop.
Save zhangkn/00ef54ed416e24511551706e54b66008 to your computer and use it in GitHub Desktop.
var image = wx.createImage()
// 设置 Image 对象的 src 属性可以加载一张本地图片或网络图片,当图片加载完毕时会执行注册的 onload 回调函数,此时可以将 Image 对象绘制到 Canvas 上。
image.onload = function () {
console.log(image.width, image.height)
context.drawImage(image, 0, 0)
}
image.src = 'logo.png'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment