package com.tt.honeyDue.platform

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.toComposeImageBitmap
import org.jetbrains.skia.Image

@Composable
actual fun rememberImageBitmap(imageData: ImageData): ImageBitmap? {
    return remember(imageData) {
        try {
            val skiaImage = Image.makeFromEncoded(imageData.bytes)
            skiaImage.toComposeImageBitmap()
        } catch (e: Exception) {
            null
        }
    }
}
