Bitmap 用于顯示圖像,使用例子如下:
const bitmap = new cax.Bitmap(img)
stage.add(bitmap)
stage.update()
如果只傳 url 而不是 Image 對(duì)象的實(shí)例,需要這樣:
const bitmap = new cax.Bitmap('./wepay.png', ()=>{
stage.update()
})
stage.add(bitmap)
這里需要注意小程序需要配置 downloadFile 需要配置合法域名才能正常加載到圖片。
可以設(shè)置圖片裁剪顯示區(qū)域,和其他 transform 屬性:
bitmap.rect = [0, 0, 170, 140]
bitmap.x = 200
更多建議: