JetBrains / skiko

Kotlin Multiplatform bindings to Skia
Apache License 2.0
1.84k stars 119 forks source link

Draw bytes on canvas #478

Closed igr closed 2 years ago

igr commented 2 years ago

I get the canvas bytes like this:

bitmap.peekPixels()!!.buffer.bytes

I then manipulate bytes etc. Then, I want to update the whole canvas with the bytes, but I can't create an Image from raw bytes

val i = Image.makeFromEncoded(bytes)    // exception
val i = Image.makeFromPixmap(Pixmap.make(ImageInfo.DEFAULT, Data.makeFromBytes(this.bytes),this.bytes.size)) // exception
canvas.drawImage(i, 0f, 0f)

How to create an image from the raw bytes?

igr commented 2 years ago

this.bitmap.installPixels(this.bytes) solves

okushnikov commented 1 month ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.