microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.34k stars 677 forks source link

RadialGradientBrush should expose AlphaMode setting (WCT compat) #2385

Open michael-hawker opened 4 years ago

michael-hawker commented 4 years ago

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: image

Premultiplied: image

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

michael-hawker commented 4 years ago

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.

michael-hawker commented 4 years ago

@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?

marcelwgn commented 4 years ago

@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.

michael-hawker commented 4 years ago

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.

michael-hawker commented 4 years ago

@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?

marcelwgn commented 4 years ago

Great idea! That would definitely make it easier to filter through issues (and see where one might easily contribute).

michael-hawker commented 4 years ago

@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). 😋

marcelwgn commented 4 years ago

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.

michael-hawker commented 4 years ago

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?

marcelwgn commented 4 years ago

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!