Make iOS application work

This commit is contained in:
Syer10
2023-12-01 22:08:05 -05:00
parent c5c83b5e51
commit 0b4e201808
7 changed files with 68 additions and 66 deletions

View File

@@ -15,6 +15,7 @@ import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.toComposeImageBitmap
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import dev.icerock.moko.resources.ImageResource
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.get
import org.jetbrains.skia.ColorAlphaType
import org.jetbrains.skia.ColorType
@@ -42,6 +43,7 @@ actual fun ImageResource.toPainter(): Painter {
// Taken from https://github.com/touchlab/DroidconKotlin/blob/main/shared-ui/src/iosMain/kotlin/co/touchlab/droidcon/ui/util/ToSkiaImage.kt
// TODO: Add support for remaining color spaces when the Skia library supports them.
@OptIn(ExperimentalForeignApi::class)
private fun UIImage.toSkiaImage(): Image? {
val imageRef = CGImageCreateCopyWithColorSpace(this.CGImage, CGColorSpaceCreateDeviceRGB()) ?: return null