Closing the functionality gap with Android T / Com...
# compose-desktop
k
Closing the functionality gap with Android T / Compose on Android for shader-backed render effects that can run on any node in Compose hierarchy. This Skiko issue has a bit more technical detail. Once the PR linked in it is merged, and Compose Desktop picks up that version of Skiko, it will be made available for all supported desktop platforms. This demo is a simpler one, applying a static shader render effect. This demo is a bit more complex (see attached video). It shows a dynamic shader that "combines" two child shaders, one that blurs the left part of the button, and another that colorizes the right part of the button to be red-tinted. The slider under the button is wired to change the horizontal boundary between the two child shaders, showing how to combine
remember { mutableStateOf }
together with the newly added binding to the underlying
SkRuntimeShaderBuilder::uniform
. When the mouse is moved over the button, the amount of blur and red tinting goes down, showing how to combine
derivedStateOf
with the same
SkRuntimeShaderBuilder::uniform
. Apart from the more demo-ey nature of this video, this should enable not only the things done in Android (stretch overscroll, content blur, fancy ripples), but also things like image editing with quick live previews of effects, introduction tutorials that blur / highlight relevant parts of the UI, and many more.
🤯 8
👏 8
👍 2
🥰 1
👍🏻 1
😮 7
👏🏻 1
m
Are shaders in CfD also written in Android Graphics Shading Language (AGSL) ?
k
m
Skia got a new website!
Looks a lot like how JavaFX does it, except exposed as a public API.
I'm curious if anyone ever tried to port implement a Java2D graphics context onto Skia? Is that a part of CfD already? I guess it must be due to the Swing interop, but that seems like an independently useful component.
k
m
Neat, thanks.
k
I don't think that it should be a part of Compose Desktop though.
It's also using different Skia bindings - see https://github.com/jfree/skijagraphics2d/issues/7 for more info
m
Is Skiko only usable from Kotlin codebases? Normally Java code can call into Kotlin classes. You're using coroutines or DSLs or something?
k
A question for me? If so, I have linked to the two demos both of which are Compose apps.
m
Sorry, I meant, why does using Skiko require converting the library to Kotlin first? (I haven't looked at the Skiko API). Normally, Kotlin classes are usable from Java.
k
That would be up to David (JFree developer) to decide whether to make the switch, and where to draw the "line" between Java and Kotlin.