Describe the bug
One thing we did when we added the RadialGradientBrush to the Windows Community Toolkit is add an AlphaMode
property from the underlying Win2D systems. This allowed for finer control of the brush settings, especially for transparency. We left the defaults for WPF compatibility of course.
Screenshots
From Toolkit sample app:
Default behavior:
Premultiplied:
Version Info
NuGet package version: v2.4.0-prerelease.200422001
| Windows 10 version | Saw the problem? |
| :--------------------------------- | :-------------------- |
| Insider Build (xxxxx) | |
| November 2019 Update (18363) | |
| May 2019 Update (18362) | |
| October 2018 Update (17763) | |
| April 2018 Update (17134) | |
| Fall Creators Update (16299) | |
| Creators Update (15063) | |
| Device form factor | Saw the problem? |
| :-------------------- | :------------------- |
| Desktop | |
| Mobile | |
| Xbox | |
| Surface Hub | |
| IoT | |
Additional context
I did try to build a sample with both versions of the RadialGradientBrush, but then started getting a XamlParseException, so not too sure what's going on.
@SavoySchuler actually looking at the updated docs from the release, what does the new InterpolationSpace property do? Is that a superset of our ColorInteropolationMode
property?
@michael-hawker Yes the InterpolationSpace is essentially a superset of the WCT's RadialGradientBrushes ColorInterpolationMode. The WinUI one has more/different ways to interpolate between colors compared to the WCT one.
Thanks @chingucoding, I've updated to just scope to the AlphaMode
then. It's a tiny property, but really makes a nice looking difference I find with transparent stops.
@SavoySchuler @stmoy should we have a Windows Community Toolkit Migration
type label for issues like this one, the now closed #2007 馃帀, and #2216 for things missing from WinUI migrated components preventing their deprecation in the toolkit?
Great idea! That would definitely make it easier to filter through issues (and see where one might easily contribute).
@chingucoding exactly, usually most of the heavy lifting on these items is done in the initial feature work. For instance, I imagine adding this last property should be pretty straight-forward for RadialGradientBrushes case (famous last words). 馃構
Left this comment on the PR to depricate it in WCT, leaving this here too for clarity:
The WinUI brush uses the CompositionRadialGradientBrush which does not expose this property (or anything comparable). Maybe somebody else knows more about this, but I don't think that the current implementation would be able to provide an AlphaMode
property.
Thanks @chingucoding, I didn't realize it didn't eventually map down to the Win2D one. I guess this may be a WinUI 3 based ask then, as that brush should come along there too, eh?
Yes with WinUI 3 it probably would be possible to reach full feature parity. Also the limitation of 1803+ and the fallback are gone too with WinUI 3!