Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-64633

QtWin::fromHBITMAP treats QtWin::HBitmapAlpha as QtWin::HBitmapPremultipliedAlpha

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.9.2
    • Extras: Win
    • 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.

      Attachments

        1. fromHBitmap.png
          fromHBitmap.png
          27 kB
        2. qtbug64633.zip
          4 kB
        For Gerrit Dashboard: QTBUG-64633
        # Subject Branch Project Status CR V

        Activity

          People

            kleint Friedemann Kleint
            garethlowe Gareth Lowe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes