How to use RGBQUAD to create system-wide shaders?

59 Views Asked by At

There's some videos online of people using Windows' gdi32.dll to create very intense and colorful effects over the entire desktop screen, some using the RGBQUAD struct. See the image below for an arbitrary example.

Here the backdrop is indeed Windows XP's classic wallpaper, with the RGBQUAD struct being utilized to create the red/green overlay.

I am trying to replicate this in C#, but I'm having trouble understanding how exactly such an effect is done, and how the RGBQUAD struct plays into this.

In my attempt to replicate the example given above I have used the following import statement to define the RGBQUAD struct:

[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct RGBQUAD
{
    public byte rgbBlue;
    public byte rgbGreen;
    public byte rgbRed;
    public byte rgbReserved;
}

Honestly, I tried a bunch of different things but none of them worked and I'm not exactly sure what I'm doing, so I feel it would be better for the answers that I don't include any of my code here, but if I understand correctly this problem would be best tackled if you use GetDC(IntPtr.Zero) to get the entire desktop's Device Context, create a memoryDC of that and a compatible bitmap, then loop over every pixel in the bitmap where you convert it's color values to the RGBQUAD format, change it based on the color you want and then overwrite it?

How is one supposed to go about this?

0

There are 0 best solutions below