Fix drawing wxBitmap with both alpha channel and mask

For 32 bpp wxBitmap with both alpha channel and mask we have to apply mask on our own while drawing the bitmap because MaskBlt() API doesn't work properly with 32 bpp RGBA bitmaps. To do so we need to create a temporary bitmap with copy of original RGB data and with alpha channel being a superposition of the original alpha values and the mask.

See #18498.
This commit is contained in:
Artur Wieczorek
2019-09-12 23:54:00 +02:00
parent b2cdcb6824
commit 2d15218c9d
4 changed files with 82 additions and 3 deletions

View File

@@ -734,6 +734,10 @@ public:
@remarks The bitmap object owns the mask once this has been called.
@note A mask can be set also for bitmap with an alpha channel but
doing so under wxMSW is not recommended because performance of drawing
such bitmap is not very good.
@see GetMask(), wxMask
*/
virtual void SetMask(wxMask* mask);
@@ -777,6 +781,10 @@ wxBitmap wxNullBitmap;
When associated with a bitmap and drawn in a device context, the unmasked
area of the bitmap will be drawn, and the masked area will not be drawn.
@note A mask can be associated also with a bitmap with an alpha channel
but drawing such bitmaps under wxMSW may be slow so using them should be
avoided if drawing performance is an important factor.
@library{wxcore}
@category{gdi}