Support HDR Capture#660
Merged
Merged
Conversation
Added two new user-scoped Boolean settings: HdrCaptureCorrection and HdrBorderlessGranted, both defaulting to False. Updated App.config, Settings.settings, and Settings.Designer.cs to support these options as strongly-typed properties.
Introduce DisplayHdrInfo, HdrScreenCapture, and HdrToneMapper under Text_Grab.Utilities.Hdr. These components enable accurate detection of per-monitor HDR state, high-precision screen capture from HDR displays, and correct tone-mapping to SDR bitmaps. Addresses washed-out capture issues on HDR monitors by leveraging DXGI, Direct3D 11, and Windows.Graphics.Capture APIs.
Integrate HDR screen region capture with tone mapping fallback to GDI when needed. Add Vortice.Direct3D11/DXGI dependencies for HDR support. Refactor ImageMethods to centralize capture logic. Add HdrToneMapper unit tests to validate tone mapping behavior.
Added an "HDR Displays" section to GeneralSettings with a toggle for HDR capture correction and a button to check/grant borderless capture permissions. Updated code-behind to handle toggle state, update settings, and display permission status to the user. Added explanatory text for new options.
Added Bash(git log *) to settings.local.json to permit execution of git log commands via Bash, expanding the set of allowed command patterns.
Added Bash(gh pr view *) and Bash(gh pr diff *) to the allowlist in settings.local.json, enabling use of GitHub CLI commands for viewing and diffing pull requests.
Refactored HDR screen capture to use a process-wide shared D3D11 device, context, and WinRT device for efficiency and reliability. Reduced frame timeout to 250ms to avoid UI stalls. Added helpers for device lifecycle management and improved error handling to recover from device loss. Ensured proper resource cleanup and event unsubscription.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Classification
New feature and bug fix to support accurate screen capture on HDR displays and resolve washed-out screenshot issues.
PR Summary
This PR adds HDR-aware screen capture and tone-mapping to correct brightness on HDR monitors, introduces user settings for HDR correction, and provides unit tests for the new logic.
DisplayHdrInfo,HdrScreenCapture, andHdrToneMapperclasses in Text_Grab.Utilities.Hdr for HDR detection, capture, and tone-mapping.ImageMethodsto use HDR capture and tone-mapping when enabled.GeneralSettings.xamlandGeneralSettings.xaml.cswith HDR correction toggles and borderless capture permission UI.HdrToneMapperTests.cs.Closes #111