You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just in case, you can easily move core part of the library to the KMM. I used that code snippet to crop an image on the iOS side:
@OptIn(ExperimentalForeignApi::class)
actual class ImageCropUtilsImpl : ImageCropUtils {
override fun cropTo(source: ImageBitmap, rect: IntRect): ImageBitmap {
val skiaImage = Image.makeFromBitmap(source.asSkiaBitmap())
val encoded = skiaImage.encodeToData()
if (encoded == null) {
Napier.e { "Failed to encode an image" }
return source
}
val oldImage = UIImage(encoded.bytes.toData())
val platformRect = CGRectMake(
x = rect.left.toDouble(),
y = rect.top.toDouble(),
width = rect.width.toDouble(),
height = rect.height.toDouble()
)
val imageRef = CGImageCreateWithImageInRect(oldImage.CGImage, platformRect)
val result = UIImage.imageWithCGImage(imageRef, oldImage.scale, oldImage.imageOrientation)
CGImageRelease(imageRef)
return UIImagePNGRepresentation(result)?.toByteArray()?.toImageBitmap() ?: source
}
}
However, I used that awesome library as a reference and guide for implementation, eventually I ended up having a bit different code and a bit different set of features that suites my needs (not so rich as provided by that awesome library)
Hi
Thank you for your good library
Is it possible to develop for compose multiplatform?
https://www.jetbrains.com/lp/compose-multiplatform/
The text was updated successfully, but these errors were encountered: