Is there a built in way to create an ImageBitmap f...
# compose
e
Is there a built in way to create an ImageBitmap from an array of rgba values?
t
You can use the normal android Bitmaps which support that. Nothing special in Compose here.
Copy code
Bitmap.createBitmap(rgbaArray, width, height, config).asImageBitmap()
e
I'm using the multiplatform version of Compose, and trying to recreate this - https://medium.com/@bantic/hand-coding-a-color-wheel-with-canvas-78256c9d7d43
t
Unfortunatley in Compose for Desktop you have to use the Skia library for bitmap handling.
There is Image.makeFromEncoded(bytes) but this expects an compressed image format.
You could use BufferedImage from Swing but i think this is not so good performance like skia.
@eygraber You know that you can also draw canvas in Compose?
e
Yup, I solved it using drawOval for each Pixel. Thanks 😅
101 Views