i'm having trouble converting a skiko Bitmap to an...
# kotlin-native
n
i'm having trouble converting a skiko Bitmap to an NSImage. wondering if anyone has got this working. here's what i've tried; but it throws an NPE:
Copy code
val nsImage = bitmap.readPixels()?.let { pixels ->
    NSImage(data = pixels.usePinned {
        NSData.create(it.addressOf(0), pixels.size.convert())
    })
}
i've also only found this helper for NSData -> skiko Image. nothing for the other direction: https://github.com/JetBrains/skiko/blob/master/skiko/src/darwinMain/kotlin/org/jetbrains/skia/Image.darwin.kt
j
Not sure how useful I'll be, but which part threw the NPE? Was it a Kotlin NPE or was it native?
n
thanks for following up. i actually got a resolution thanks to this other follow up: https://kotlinlang.slack.com/archives/C3PQML5NU/p1741916957234829. encoding the bytes worked.