Fix HDR screenshot brightness by applying tone mapping#588
Draft
Fix HDR screenshot brightness by applying tone mapping#588
Conversation
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for HDR in text grab functionality
Fix HDR screenshot brightness by applying tone mapping
Dec 22, 2025
Owner
|
@copilot rebase |
Contributor
Author
The branch is already up-to-date with |
Owner
|
@copilot rebase on |
- Add TranslateText method to WindowsAiUtilities.cs using LanguageModel - Add translation settings to Settings files - Add translation toggle button and menu with language selection to GrabFrame.xaml - Implement translation logic in GrabFrame.xaml.cs with timer-based translation - Store original texts and restore them when translation is disabled - Support 12 target languages (English, Spanish, French, German, Italian, Portuguese, Russian, Japanese, Chinese, Korean, Arabic, Hindi) Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
- Add detailed comments explaining the translation approach - Use TextRewriter with custom translation prompt as workaround - Note that Microsoft.Extensions.AI could be added for better translation support Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
- Auto-freeze frame when translation is enabled for static content - Implement parallel translation of word borders for better performance - Use Dispatcher.InvokeAsync for thread-safe UI updates Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
- Hide translation button when Windows AI is not available - Update tooltip to show current target language - Improve user experience with dynamic tooltip updates Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
- Remove Task.Run with async lambdas to avoid thread pool issues - Add debug logging for translation errors - Replace hard-coded array index with robust menu search - Simplify translation logic to sequential processing Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
- Add semaphore to limit concurrent translations (max 3) - Extract translation logic into testable async Task methods - Replace magic string with constant - Add comprehensive XML documentation about translation limitations - Properly dispose semaphore on unload Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
- Replace hardcoded translation prompt with template constant - Improve code maintainability and allow for future customization Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
- Add Translate submenu with 12 language options to Local AI menu - Implement TranslateMenuItem_Click handler following existing pattern - Uses WindowsAiUtilities.TranslateText for translation - Supports both selected text and full text translation - Displays loading indicator during translation Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
- Show warning dialog if translation fails or returns unchanged text - Catch and display exceptions with appropriate error message - Improve user feedback when translation doesn't work Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
- Keep basic exception handling with error dialog - Remove check for unchanged text to match other AI handlers - More consistent with SummarizeMenuItem, RewriteMenuItem patterns Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Updated error message display to explicitly use System.Windows.MessageBox to avoid potential naming conflicts.
Updated translation prompt for clarity and consistency, added a dedicated system prompt constant, and streamlined method documentation.
Enables Windows AI-powered translation for each word, adds progress feedback and cancellation, and optimizes resource usage with shared model and fast language detection.
Enable translating grabbed text to system language using Windows AI if available. Adds UI option and language detection for translation workflow.
Enables quick translation to system language, improves error handling, and updates UI menu dynamically. Includes minor formatting fixes.
Improves robustness by safely handling cases where recognizedText.Lines is null, preventing possible null reference exceptions.
…de quality issues - Add Cleanup() method to WindowsAiUtilities for proper disposal of static semaphore - Fix race condition in translation cancellation by using ThrowIfCancellationRequested() - Add null check for TranslationMenuItem to prevent NullReferenceException - Extract common translation logic into PerformTranslationAsync() helper method - Always dispose translation model on window unload regardless of translation state - Remove unused isTranslating field from GrabFrame - Replace duplicate GetSystemLanguageName() with call to LanguageUtilities.GetSystemLanguageForTranslation() - Fix indentation in WindowsAiUtilities.cs (TranslateText method and documentation) - Fix indentation in GrabFrame.xaml.cs (CancelTranslationButton_Click method) - Use explicit .Where() filtering in foreach loops for better clarity - Use object.ReferenceEquals() for null checks in double-checked locking pattern - Combine nested if statements for targetCode == "en" check - Keep explicit if/else for text assignment for better readability Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
- Add Cleanup() method for proper disposal of static semaphore - Use object.ReferenceEquals() for null checks in double-checked locking - Use explicit .Where() filtering in foreach loop - Combine nested if statements for targetCode check Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Added GitHub Sponsors, Buy Me a Coffee, and updated PayPal link.
Improves UI structure, type safety, and translation feature gating based on Windows AI availability.
Introduce a configurable system for post-capture actions in Fullscreen Grab, including a new settings dialog, dynamic menu generation, and persistent user preferences. Refactor related models and UI for extensibility and maintainability. Add unit tests for action management logic.
Introduces a user setting and UI toggle to control whether the post-grab menu stays open after selecting an action. Also adds InputGestureText to ButtonInfo.
Removed InputGestureText from ButtonInfo and related tests. Input gestures for post-grab actions are now set dynamically in FullscreenGrab.
…on, fix event handler leaks Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Reduced editor window height and updated ListView scrollbars. Commented out the "Translate to system language" post-grab action.
Adjusted test expectations after removing the action from defaults.
Updated NuGet package versions for bug fixes and compatibility. Enhanced SettingsWindow navigation menu for better text wrapping and readability.
Contributor
Author
Rebased onto Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
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.
Summary
Successfully rebased HDR support implementation onto the latest
devbranch. All changes apply cleanly with no conflicts. The solution:Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.