On 4/24/22 22:05, Nikolay Sivov wrote:
On 4/23/22 20:53, Jinoh Kang wrote:
+ [v1_enum] enum _SIIGBF { + SIIGBF_RESIZETOFIT = 0x00000000, + SIIGBF_BIGGERSIZEOK = 0x00000001, + SIIGBF_MEMORYONLY = 0x00000002, + SIIGBF_ICONONLY = 0x00000004, + SIIGBF_THUMBNAILONLY = 0x00000008, + SIIGBF_INCACHEONLY = 0x00000010, + SIIGBF_CROPTOSQUARE = 0x00000020, + SIIGBF_WIDETHUMBNAILS = 0x00000040, + SIIGBF_ICONBACKGROUND = 0x00000080, + SIIGBF_SCALEUP = 0x00000100, + }; + typedef DWORD SIIGBF;
I see this using int instead of DWORD in 10.0.22000.0, did it change?
That's about right. No idea where the DWORD came though...
Because you have to convert potentially-transparent HICON to HBITMAP with alpha channel, which is quite a complicated feat.
- HICON can take many pixel formats, ranging from 32-bit ARGB and monochrome with mask.
- hbmColor and hbmMask combinations aren't exactly simple to handle.
- Windows always seems to output a 32-bit ARGB bitmap. GDI routines alone aren't particularly suited for the task (GdiAlphaBlend works with PARGB, not ARGB).
Only WIC and GDI+ has functions to handle most of these.
Same SDK claims output could be RGB24, RGB32, or PARGB32, but it can't be trusted of course.
There is an API sample from Microsoft: https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7S... Basically it feeds IShellItemImageFactory output directly into a SS_BITMAP static control.
Note that static controls are known to accept ARGB32 bitmaps, which is converted into PARGB32 internally: - https://source.winehq.org/git/wine.git/blob/f4fdafbb5597bde5d2d3433d5c64f5a7...
This is also consistent with Wine behaviour: - https://source.winehq.org/git/wine.git/blob/f4fdafbb5597bde5d2d3433d5c64f5a7...
Ideally it would be nice if we could test the pixel format, but there is no reliable way to detect if a given GDI bitmap is in ARGB32 or PARGB32. (Specifically, a PARGB32 bitmap can always be interpreted as a valid ARGB32 bitmap, but not vice versa.)
At least, the output bitmap was observed to be consistently ARGB32 regardless of which pixel format the source icon used (e.g. 8-bit color, RGB32, or ARGB32).