Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.9.2
-
None
-
Windows 10 x64 Ver. 1703 Build 15063.726
Description
When using 'QtWin::fromHBITMAP' with a HBITMAP with a plain alpha channel (not premulitplied) and the HBitmapFormat 'QtWin::HBitmapAlpha' the returned QPixmap is incorrect.
I believe the error is in function 'qt_pixmapFromWinHBITMAP' where the image format 'QImage::Format_ARGB32_Premultiplied' is used for both alpha formats.
Instead I believe the image format 'Format_ARGB32' should be used for 'HBitmapAlpha', and 'Format_ARGB32__Premultiplied' for 'HBitmapPremultipliedAlpha'
The attached image shows 4 pixmaps created from the same HBITMAP.
The top row is the current 'fromHBITMAP' function, and the bottom row uses a corrected version of the function with the above suggested correction.
The left column uses hbitmatformat 'HBitmapAlpha' and the right uses 'HBitmapPremultipliedAlpha'.
The attached archive is the code used to create the attached image.
The first argument should be a existing file or folder path.
Using 'IShellItemImageFactory::GetImage' its gets a HBITMAP of the files thumbnail or icon.
It then creates the 4 pixmaps and displays them.
Thanks for looking at this issue.