In-app acrylic effect #435
Replies: 2 comments 1 reply
-
Very nice. I too have experimented with this and have my own "AcrylicPanel". I almost used/included this in the new sample app on the home page tiles like WinUI3 does, but decided not to for a few reasons
I know composition brushes are planned at some point in Avalonia, which I think will include an acrylic brush, but not sure on the timeline. I think it's best to wait for that, as if they're implemented upstream in the composition system, there may be more optimizations that can make it better. However, if that turns out to not be anytime soon and this is deeply desired, I can look into adding this into the "experimental, you're on your own" namespace like ConnectedAnimation is. |
Beta Was this translation helpful? Give feedback.
-
Thanks for sharing your insights :) I experimented a bit more with this, especially with different combinations of blend modes and I did get a bit closer to WinUI's effect. One major issue I had with it which ultimately caused me not to use it for now is that it doesn't blend with the Mica effect. Composition brushes sound interesting, and they do sound more suitable so I don't blame you for waiting on those. Admittedly I do not know how they tie into this and would enable an acrylic effect where that is currently not possible. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
Since Avalonia 11 I've been tinkering around a bit with
ICustomDrawOperation
to see how close I could get to an acrylic blur effect.I think I have some decent results:

Original:


Source: https://github.com/Artemis-RGB/Artemis/tree/e03d6b20e9165d364223fe875097b429fac7668c/src/Artemis.UI/Controls/AcrylicBlur
However, when it comes to authoring controls I'm not nearly as experienced as @amwx and I ran into quite a few snags. But I thought I'd at least bring up the fact that this effect is now possible to achieve.
It would be pretty cool to include in FluentAvalonia one way or another. WinUI's approach of a custom brush is the most elegant I think, but may be difficult to reproduce in Avalonia, I did this as a ContentControl because it was the quickest way for me to get something that works and can host another element.
Some things I ran into
Render
on theICustomDrawOperation
gets called again but with a smaller dirtied rectangle. To combat this I check whether the dirtied rectangle (the current clip) covers the entire element and if not, I invalidate the visual.Beta Was this translation helpful? Give feedback.
All reactions