All Downloads are FREE. Search and download functionalities are using the official Maven repository.

desktopMain.ovh.plrapps.mapcompose.utils.Source.desktop.kt Maven / Gradle / Ivy

Go to download

A Compose Multiplatform library to display tiled maps, with support for markers, paths, and rotation

The newest version!
package ovh.plrapps.mapcompose.utils

import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asComposeImageBitmap
import kotlinx.io.Source
import kotlinx.io.readByteArray
import org.jetbrains.skia.Bitmap
import org.jetbrains.skia.Image

actual fun Source.toImage(existing: ImageBitmap?, highFidelityColors: Boolean): ImageBitmap? {
    // TODO: find a way to set ColorType depending on highFidelityColors flag
    val img = Image.makeFromEncoded(this.readByteArray())
    val bitmap = Bitmap.makeFromImage(img)
    return bitmap.asComposeImageBitmap()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy