Opened 20 years ago
Closed 20 years ago
#11 closed enhancement (fixed)
Implement alpha channel support for pixmaps (QPixmap)
| Reported by: | dmik | Owned by: | dmik | 
|---|---|---|---|
| Priority: | normal | Milestone: | qt-os2-3.3.1-rc07 | 
| Component: | kernel | Version: | |
| Severity: | normal | Keywords: | alpha channel blending QPixmap | 
| Cc: | 
Description
We need to support the alpha channel in the QPixmap implementation, and correctly blend it when drawing pixmaps both to widgets and to other pixmaps.
Attachments (4)
Change History (8)
comment:1 by , 20 years ago
| Status: | new → assigned | 
|---|---|
| Type: | defect → enhancement | 
comment:2 by , 20 years ago
comment:4 by , 20 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | assigned → closed | 
Alpha blending is fully implemented now.
P.S. copyBlt() on Qt/Win32 is extremely buggy (because the destination pixmap is not dereferenced). You can see it using the updated alpha example (will attach).
  Note:
 See   TracTickets
 for help on using tickets.
    

I've just discovered that when you do bitBlt() of something directly to a pixmap, this pixmap's alpha channel will be untouched at all (no matter is it a simple mask or true alpha bits, and no matter does the source contain any alpha channel or not). So that
bitBlt (dst_pm, src_pm)followed bydrawPixmap (dst_pm)will produce visually different results comparing todrawPixmap (dst_pm)followed bydrawPixmap (src_pm). This behavioer is definitely not what you could expect (because in both cases you just draw one pixmap over another to some painter), and more over, it is not clearly documented anywhere in Qt docs.But for the sake of compatibility, I have to do the same in Qt/OS2. Keep in mind, however, that you can always correctly mix two pixmaps (in memory) by converting them to images and using
bitBltfor QImage instead.The testcase that demonstrates the above behavior is attached. Starting from the raw 3, first two columns contain results of mixing two pixmaps using
bitBltdirectly on them, last two columns contain results of converting the same pixmaps to QImages and using the QImage version ofbitBlt. The difference can be clearly observed.