CanvasContext.drawImage
Draw the image, and the image keeps the original size information.
Parameters
It is Object type.
Property | Type | Description |
imageResource | String | The image resource, only online cdn resource and offline resource are supported. The online cdn resource should contains Access-Control-Allow-Origin: * in header. |
x | Number | The x coordinate of left-upper corner of image. |
y | Number | The y coordinate of left-upper corner of image. |
width | Number | The width of the image. |
height | Number | The 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()