package com.tt.honeyDue.platform

import android.graphics.BitmapFactory
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asImageBitmap

@Composable
actual fun rememberImageBitmap(imageData: ImageData): ImageBitmap? {
    return remember(imageData) {
        try {
            val bitmap = BitmapFactory.decodeByteArray(imageData.bytes, 0, imageData.bytes.size)
            bitmap?.asImageBitmap()
        } catch (e: Exception) {
            null
        }
    }
}
