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
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
package app.klottr.net
|
||||
|
||||
import kotlinx.cinterop.ExperimentalForeignApi
|
||||
import okio.IOException
|
||||
import kotlinx.cinterop.refTo
|
||||
import platform.Foundation.NSData
|
||||
import platform.Foundation.NSURL
|
||||
import platform.Foundation.dataWithContentsOfURL
|
||||
import platform.Foundation.isFileURL
|
||||
import platform.Foundation.lastPathComponent
|
||||
import platform.Foundation.pathExtension
|
||||
import platform.posix.memmove
|
||||
|
||||
actual object ImageReader {
|
||||
actual fun init(platformContext: Any?) {
|
||||
|
||||
Reference in New Issue
Block a user