<Skiko> has support for Android too. Is there any ...
# compose-android
m
Skiko has support for Android too. Is there any way to use that with Compose? It would be nice to have such an option if a consistent multiplatform rendering infrastructure is more important than the smallest possible apk size. Lets-Plot seems to be using it too but how does that work? I haven’t found any documentation about it.
s
I believe JetBrain's Compose is simply missing certain Android implementations to utilize Skia. Additionally, using own Skia renderer would immediately disrupt the usage of AndroidView components.
It is a two-sided coin
z
The Android OS itself already uses Skia, it just wraps it with slightly higher-level APIs, which is what Compose uses on Android.
s
it's not that simple, unfortunately
z
i didn’t say anything about simple 🙂
👍 1
r
Rendering should be fairly consistant since like Zach said, both use Skia
m
I know that it is using Skia but probably not the same version that is used elsewhere depending on the age of your phone, or am I wrong with that assumption? And how do you get an instance of the above mentioned Skiko API? On other platforms you can ask for the native canvas but on Android this is not the same as elsewhere. It is the Android native canvas (which is probably the Android wrapper around Skia).
r
You are right that an older phone might have an older version of Skia
And yes on Android you get back an
android.graphics.Canvas
, which technically is not the wrapper around Skia either but a “recording Canvas”
This is what enables full interop between Compose and Views
m
And with “consistent” I do not only mean the behaviour but the fact that you can get the same low-lewel Skiko API on all platforms. Android is currently the only exception to that rule as far as I know.
r
(and a bunch of optimizations)
I would say the other platforms are the exceptions 😄
Skia is native to Android, as in it’s the rendering engine we’ve used since Android 1.0 (and we Open Sourced Skia too). We made the decision to not ship our own copy of Skia for multiple reasons:
• Interop like I mentioned
• Binary size
• To benefit from various optimizations implemented in “hwui” the layer between
Canvas
and Skia on Android