microsoft / microsoft-ui-xaml

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

Incorrect Transparency Rendering in WinUI when HDR is Enabled #8594

Open TGSAN opened 1 year ago

TGSAN commented 1 year ago

Describe the bug

When Windows HDR is enabled, semi-transparent controls rendered using WinUI exhibit incorrect transparency. However, when using Win+Shift+S to take a screenshot, the preview image shows the correct transparency. This issue is particularly noticeable in WinUI windows with a dark theme and when utilizing System Backdrop, and I believe it is related to the Alpha blending in WinUI.

Steps to reproduce the bug

  1. Connect to a display that supports HDR.
  2. Enable HDR on Windows.
  3. Open a custom-built test window or existing WinUI 2/3 applications (such as Windows Settings, Notepad, Win11 File Explorer, WinUI 3 Gallery).
  4. Observe the semi-transparent elements (e.g., TabView in Notepad) overlaid on the System Backdrop (preferably MicaAlt for better visibility).
  5. Take a screenshot preview using Win+Shift+S or toggle HDR on and off to observe the changes in transparency of the semi-transparent elements (they become less transparent in HDR mode).

Expected behavior

No response

Screenshots

The left side shows the effect with HDR enabled, while the right side shows the effect with HDR disabled or after capturing a screenshot using PrtSc (since Snipping Tool is not a WYSIWYG in this scenario, I have juxtaposed the results of PrtSc with the window and captured the screenshot using the ScreenCapture API).

2023-06-30_12-54-20

NuGet package version

WinUI 3 - Windows App SDK 1.3.2: 1.3.230602002

Windows version

Windows 11 (22H2): Build 22621

Additional context

Version: WinUI 2.7 - WASDK 1.3.2

reitowo commented 5 months ago

+1 Here, same to all transparent window with custom alpha