Remove dependencies on android bitmaps from KlottrDialog and WriteDocDialog
This commit is contained in:
@@ -37,6 +37,8 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
//TODO: OH: This file is obsolete and should be removed.
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun KlottrRoot(
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package app.klottr.images
|
||||
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import org.jetbrains.compose.resources.decodeToImageBitmap
|
||||
import app.klottr.net.ImageHandle
|
||||
import app.klottr.net.ImageReader
|
||||
|
||||
/**
|
||||
* Platform-independent: reads image bytes via ImageReader (expect/actual),
|
||||
* then decodes to ImageBitmap using Compose MPP.
|
||||
*/
|
||||
suspend fun loadImageBitmap(handle: ImageHandle): ImageBitmap? {
|
||||
val result = ImageReader.read(handle) ?: return null
|
||||
return try {
|
||||
result.bytes.decodeToImageBitmap()
|
||||
} catch (_: Throwable) {
|
||||
null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user