JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.42k stars 1.12k forks source link

Support for "Plus Darker" and "Plus Lighter" blend modes #5046

Open iamcalledrob opened 2 weeks ago

iamcalledrob commented 2 weeks ago

These two blend modes (Plus Darker, Plus Lighter) are very useful when building UI, in particular, for iOS -- yet they are missing in Compose Multiplatform.

The web now somewhat supports this kind of blending via css mix-blend-mode:

mix-blend-mode: plus-darker;
mix-blend-mode: plus-lighter;

Sidenote: I believe "Plus Darker" is also known as "Linear Burn"

Here's Figma's video showing the effect of this type of blending -- as you can see, this is necessary for building native looking UI for Apple platforms.

https://github.com/JetBrains/compose-multiplatform/assets/87964/179b8661-5c8b-4452-b8bc-5e299b399cd2

Alternatively, support for custom blend mode formulae might be even more versatile

More reading:

iamcalledrob commented 2 weeks ago

I believe this may also be made possible via a shader if RuntimeEffect.makeForBlender() (skia: SkRuntimeEffect::makeBlender) was made available within Skiko -- it's conspicuously missing.

Skiko RuntimeEffect.kt Skia SkRuntimeEffect::makeBlender

okushnikov commented 13 hours ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.