drawImage

suspend fun drawImage(name: String, config: JsonObject)

Draws the image, loading it using the resource name.

Image is always drawn preserving the aspect ratio

Following additional drawing parameters are supported:

  • width - width of the area where the image should be placed (canvas width by default)

  • height - height of the area where the image should be placed (canvas height by default)

  • fill - controls image scaling; if true (default) image should completely fill the drawing area, sides may be cropped if needed, if false image should be fully visible even if drawing area is not completely filled.

Parameters

name

name of the resource file that contains an image

config

image drawing parameters


fun drawImage(bytes: ByteString, config: JsonObject)

Draw the image encoded in the given ByteString.

Parameters

bytes

byte array that encodes the image in PNG or JPEG format

config

image drawing parameters