mactype icon indicating copy to clipboard operation
mactype copied to clipboard

[FEATURE] Add GDI text alpha blending fix

Open Undisputed00x opened this issue 1 year ago • 8 comments

Hi there, could you add a feature that fixes text alpha on GDI text, this issue is visible when having Acrylic blur windows by using MicaForEveryone with DwmExtendFrameIntoClientArea function . Enabling DirectWrite doesn't fix the problem. Here some articles that discuss this problem 1 2. This project ExplorerBlurMica that enables custom windows effects including acrylic blur has fixed this problem here

Examples of problem

https://github.com/user-attachments/assets/932bf04a-9761-4b95-936d-8948c514f8b5

SPOILER_PROBLEM1 SPOILER_PROBLEM_2

Fix of problem

SPOILER_EBM

Undisputed00x avatar Jul 17 '24 08:07 Undisputed00x

The standard Windows GDI drawtext call sets the alpha bit to 0 if the text color (a.k.a the painter color) is black or leaves whatever alpha bit is for all other colors. MacType follows the same rule to mantain max compatibility.

If you got the same result without mactype and needs a third-party app to "fix" the problem, that's a problem of the Windows by design and shouldn't be handled by mactype.

snowie2000 avatar Jul 17 '24 09:07 snowie2000

As of the Alpha bit problem in GlassFrame windows, I know it long ago. MacType has the ability to change alpha bit and was deliberately not touching it: https://github.com/snowie2000/mactype/blob/c3a52fc5343641d5e91841674380c805edbbdcdd/ft.cpp#L387-L403

snowie2000 avatar Jul 17 '24 09:07 snowie2000

If you got the same result without mactype and needs a third-party app to "fix" the problem, that's a problem of the Windows by design and shouldn't be handled by mactype.

Yeah, i know that's Windows own problem but i can't find any third party project that is closer to make a change on this issue systemwide other than mactype.

As of the Alpha bit problem in GlassFrame windows, I know it long ago. MacType has the ability to change alpha bit and was deliberately not touching it:

https://github.com/snowie2000/mactype/blob/c3a52fc5343641d5e91841674380c805edbbdcdd/ft.cpp#L387-L403

If i set 255 on alpha variables of that fuction is it going to make text opaque on glass background ?

EDIT: uhm if it's not a problem for you can you share a compiled version with the alpha changes here to test ?😅

Undisputed00x avatar Jul 17 '24 10:07 Undisputed00x

Any update on this 🙂?

Undisputed00x avatar Feb 10 '25 20:02 Undisputed00x

It can be done easily. The problem is that I don't see a reason to make it to everyone.

snowie2000 avatar Feb 11 '25 07:02 snowie2000

I understand, but fixes a current issue with GDI text being invisible when HDR/10-bit colors are enabled with a combination of translucent background effect (mica/acrylic/blur) extending in the window client area where GDI text is painted. Im newbie at coding and find it hard to build the dependencies of the project 😅

List of tickets from other third party projects about this "problem"

https://github.com/Rectify11/Installer/issues/509 https://github.com/Rectify11/Installer/issues/526 https://github.com/Rectify11/Installer/issues/585 https://github.com/Rectify11/Installer/issues/400 https://github.com/Rectify11/Installer/issues/440

https://github.com/MicaForEveryone/MicaForEveryone/issues/399 https://github.com/MicaForEveryone/MicaForEveryone/issues/386 https://github.com/MicaForEveryone/MicaForEveryone/issues/61 https://github.com/MicaForEveryone/MicaForEveryone/issues/61

https://github.com/Maplespe/ExplorerBlurMica/issues/117 https://github.com/Maplespe/ExplorerBlurMica/issues/136#issuecomment-2074087174

Undisputed00x avatar Feb 11 '25 13:02 Undisputed00x

Modifying the alpha bit of texts defies the rule to be fully compatible with what GDI does.

It will for sure cause some apps to behavior incorrectly.

Virtual box is one of its kind. It relies on the alpha bit to draw texts on its UI.

snowie2000 avatar Feb 11 '25 13:02 snowie2000

Maybe add it as a hidden experimental option in the config file 😅. Blacklisting of conflicting processes can come into play here. Obviously this doesn't address to the average user.

Undisputed00x avatar Feb 11 '25 13:02 Undisputed00x