CanvasContext.drawImage

Draw the image, and the image keeps the original size information.

Parameters

It is Object type.

PropertyTypeDescription
imageResourceStringThe image resource, only online cdn resource and offline resource are supported. The online cdn resource should contains Access-Control-Allow-Origin: * in header.
xNumberThe x coordinate of left-upper corner of image.
yNumberThe y coordinate of left-upper corner of image.
widthNumberThe width of the image.
heightNumberThe height of the image.

Sample Code

copy
//.js
const ctx = my.createCanvasContext('awesomeCanvas')
ctx.drawImage('https://img.example.com/example.jpg', 2, 2, 250, 80)
ctx.draw()