Open bmuessig opened 2 years ago
I believe this is an issue with transparency handling.
Drawing the color gradient works fine: https://github.com/Immediate-Mode-UI/Nuklear/blob/master/src/nuklear_color_picker.c#L108 The transparent black gradient in the next line does not work and always completely blacks out the color gradient.
Okay, I see the issues:
I don't think there is a quick fix for this. GDI (without plus) does not appear have enough alpha support to make this feature work. Even with double buffering and alpha blending instead of bit blitting, the alpha channel is simply ignored. This also makes me wonder, if transparent images are supported either. My best guess would be that they don't work.
I've still made a few improvements in this PR: https://github.com/Immediate-Mode-UI/Nuklear/pull/460
It seems that AlphaBlend has a critical limitation:
If the source and destination are the same surface, that is, they are both the screen or the same memory bitmap and the source and destination rectangles overlap, an error occurs and the function returns FALSE.
Source: https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-alphablend#remarks
GetLastError() after AlphaBlend() returns error code 87 == ERROR_INVALID_PARAMETER
Nevermind, I'm blind... They are not the same, but the error returned is still there.
Moreover, GetDeviceCaps(gdi.window_dc, SHADEBLENDCAPS) == SB_NONE
indicates that the context doesn't support blending. WTF?
The color matrix of the color picker is not rendered in the GDI binding:
I believe that the following method is not completely implemented: https://github.com/Immediate-Mode-UI/Nuklear/blob/master/demo/gdi/nuklear_gdi.h#L240