I have an image encoded as 2D array of colors like this:
val pixels = arrayOf(
arrayOf(color1, color2,... colorN),
...
)
I would like to draw it pixel-by-pixel on Compose Canvas (desktop application, not Android):
Canvas(
modifier = Modifier
.size(200.dp)
.background(Color.White)
) {
drawPixels(pixels) //need function like this
}
The only way I found is to use drawPoints
but it required list of points for every color. Not the best way if I have hundreds of different colors.
How can I draw an array of pixels?