https://kotlinlang.org logo
k

Kirill Grouchnikov

11/17/2020, 5:37 AM
There are examples of creating an empty
ImageAsset
and drawing on it - such as
ImageAssetSample
, but it's a chicken-and-egg problem. In order to be able to draw a dynamic "bitmap" onto it, such a bitmap would first need to already exist.
n

Nader Jawad

11/17/2020, 4:27 PM
Similar to Android you can create an ImageAsset and pass it to the constructor of a Canvas and to draw into the ImageAsset (now called ImageBitmap)
k

Kirill Grouchnikov

11/17/2020, 4:39 PM
But again, how do I "draw" an array of ints / pixels onto it?
This approach works to draw shapes, lines, points, etc. But not a dynamically created image.
n

Nader Jawad

11/17/2020, 5:23 PM
Discussed offline. We will be adding a
setPixels
API to ImageAsset to configure the pixel information if it is retrieved from elsewhere. Thanks!
👍 1
k

Kirill Grouchnikov

11/17/2020, 6:22 PM
Meanwhile I filed https://github.com/JetBrains/compose-jb/issues/111 as I can't even create an empty bitmap on desktop
3 Views