It feels like ILD_NORMAL and ILD_TRANSPARENT not differ in action. And ILD_IMAGE not works at all. I think it has something to do with this:
QuoteAn overlay image is drawn transparently over the primary image specified in the i parameter. To specify an overlay image in the fStyle parameter, use the INDEXTOOVERLAYMASK macro to shift the one-based index of the overlay image. Use the OR operator to logically combine the return value of the macro with the drawing style flags specified in the fStyle parameter. You must first specify this image as an overlay image by using the ImageList_SetOverlayImage function.
learn.microsoft.com (https://learn.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-imagelist_draw)
Quote from: Villuy on February 25, 2025, 04:19:35 PMIt feels like ILD_NORMAL and ILD_TRANSPARENT not differ in action. And ILD_IMAGE not works at all. I think it has something to do with this:
QuoteAn overlay image is drawn transparently over the primary image specified in the i parameter. To specify an overlay image in the fStyle parameter, use the INDEXTOOVERLAYMASK macro to shift the one-based index of the overlay image. Use the OR operator to logically combine the return value of the macro with the drawing style flags specified in the fStyle parameter. You must first specify this image as an overlay image by using the ImageList_SetOverlayImage function.
learn.microsoft.com (https://learn.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-imagelist_draw)
Can you post an example where you have these issues? It might be due to some unforseen issue elsewhere in your code. I am no expert in grahics functions, but others here may be able to help you. Just saying something
"doesn't work" is meaningless without knowing how you are trying to implement those functions. :icon_idea: Maybe you are missing some crucial step or other detail in the code?
I won't write all code. Here's the main thing:
1. Loading bitmap from resources:
invoke ImageList_LoadImage, HdlInstance, ResBmp, 20, 10, ClrMagenta, IMAGE_BITMAP, LR_CREATEDIBSECTION
mov HdlIml, eax
2. Now let's draw it. Three variants:
a) invoke ImageList_Draw, HdlIml, 0, HdlMemDc, 0, 0, ILD_NORMAL
b) invoke ImageList_Draw, HdlIml, 0, HdlMemDc, 0, 0, ILD_TRANSPARENT
c) invoke ImageList_Draw, HdlIml, 0, HdlMemDc, 0, 0, ILD_IMAGE
ILD_NORMAL and ILD_TRANSPARENT replace mask with background identically in all situations. Although they must be different in some way.
ILD_IMAGE replace mask with black color although it shouldn't touch mask at all.
Okay that should help. Without asking questions we are only left to speculate what could be wrong.
When you draw the image, does it get drawn at all?
Have you used this function successfully in the past? Or is this your first time using ImageList_Draw?
Is this happening with only one specific bitmap image? Or does it give the same results with others as well?
Did you check that the equates for ILD_NORMAL, ILD_TRANSPARENT, etc. have the correct values?
I have no experience with that function, but someone here probably does...
I'm telling that code draws. If remove mask then bitmap is drawed as should be:
invoke ImageList_LoadImage, HdlInstance, ResBmp, 20, 10, CLR_NONE, IMAGE_BITMAP, LR_CREATEDIBSECTION
So code context is ok.