terminal/src/cascadia
Mike Griese c803893c22
Use grayscale AA always on non-opaque backgrounds (#5277)
## Summary of the Pull Request

When we're on acrylic, we can't have cleartype text unfortunately. This PR changes the DX renderer to force cleartype runs of text that are on a non-opaque background to use grayscale AA instead.

## References

Here are some of the URLS I was referencing as writing this:

* https://stackoverflow.com/q/23587787
* https://docs.microsoft.com/en-us/windows/win32/direct2d/supported-pixel-formats-and-alpha-modes#cleartype-and-alpha-modes
* https://devblogs.microsoft.com/oldnewthing/20150129-00/?p=44803
* https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_layer_options
* https://docs.microsoft.com/en-us/windows/win32/direct2d/direct2d-layers-overview#d2d1_layer_parameters1-and-d2d1_layer_options1
* https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ne-dcommon-d2d1_alpha_mode?redirectedfrom=MSDN#cleartype-and-alpha-modes
* https://stackoverflow.com/a/26523006

Additionally:
* This was introduced in #4711 

## PR Checklist
* [x] Closes #5098
* [x] I work here
* [ ] Tests added/passed
* [n/a] Requires documentation to be updated

## Detailed Description of the Pull Request / Additional comments

Basically, if you use cleartype on a light background, what you'll get today is the text foreground color _added_ to the background. This will make the text look basically invisible. 

So, what I did was use some trickery with `PushLayer` to basically create a layer where the text would be forced to render in grayscale AA. I only enable this layer pushing business when both:
  * The user has enabled cleartype text
  * The background opacity < 1.0

This plumbs some information through from the TermControl to the DX Renderer to make this smooth.

## Validation Steps Performed

Opened both cleartype and grayscale panes SxS, and messed with the opacity liberally.
2020-04-24 17:16:34 +00:00
..
CascadiaPackage Include Cascadia Mono in-package, switch to it by default (#5505) 2020-04-23 22:12:36 +00:00
inc ci: run spell check in CI, fix remaining issues (#4799) 2020-03-25 11:02:53 -07:00
LocalTests_TerminalApp Rename copy keybinding arg (#5216) 2020-04-02 23:10:28 +00:00
PublicTerminalCore Adjusts High DPI scaling to enable differential rendering (#5345) 2020-04-22 14:59:51 -07:00
TerminalApp Include Cascadia Mono in-package, switch to it by default (#5505) 2020-04-23 22:12:36 +00:00
TerminalAzBridge deps: upgrade CppWinRT to 2.0.200316.3, gsl to v2.1.0 (#4536) 2020-03-23 17:15:24 +00:00
TerminalConnection Add WT_PROFILE_ID to the environment of the spawned process (#4852) 2020-04-17 17:15:20 +00:00
TerminalControl Use grayscale AA always on non-opaque backgrounds (#5277) 2020-04-24 17:16:34 +00:00
TerminalCore Make sure background color is opaque when attrs are reversed (#5509) 2020-04-23 14:35:12 -07:00
TerminalSettings Rework and simplify selection in TermControl (#5096) 2020-03-25 21:09:49 +00:00
UnitTests_TerminalCore Add a test to cover #5428 (#5449) 2020-04-22 11:16:17 +00:00
ut_app ci: run spell check in CI, fix remaining issues (#4799) 2020-03-25 11:02:53 -07:00
WindowsTerminal Re-enable Ctrl-C if the application that spawned us disabled it (#5472) 2020-04-23 08:00:42 -07:00
WindowsTerminalUniversal build: move oss required to build conhost out of dep/ (#5451) 2020-04-21 14:43:09 -07:00
WinRTUtils deps: upgrade CppWinRT to 2.0.200316.3, gsl to v2.1.0 (#4536) 2020-03-23 17:15:24 +00:00
WpfTerminalControl wpf: only dismiss selection for real chars, not modifiers (#5388) 2020-04-17 11:28:56 -07:00
CascadiaResources.build.items Include Cascadia Mono in-package, switch to it by default (#5505) 2020-04-23 22:12:36 +00:00