#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent platforms

131 views
Skip to first unread message

wxTrac

unread,
Sep 10, 2019, 5:26:53 PM9/10/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
---------------------+-------------------------
Reporter: awi | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Keywords: | Blocked By:
Blocking: | Patch: 0
---------------------+-------------------------
32 bpp `wxBitmaps` with both alpha channel and masks are not drawn the
same way under all platforms.
[[Image(bitmap_mask_MSW.png)]] [[Image(bitmap_mask_GTK.png)]]
[[Image(bitmap_mask_OSX.png)]]

It seems that drawing works as expected under `wxGTK3`: both alpha channel
and mask values are taken into account.
Under `wxOSX` it looks like if mask superseded (disabled) alpha channel.
Under `wxMSW` it is hard to tell what is going on.

Here is the patch to minimal sample to demonstrate the issue.
{{{
#!diff
diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp
index 0d91f7fc75..85fc0a01af 100644
--- a/samples/minimal/minimal.cpp
+++ b/samples/minimal/minimal.cpp
@@ -139,6 +139,7 @@ bool MyApp::OnInit()
//
----------------------------------------------------------------------------
// main frame
//
----------------------------------------------------------------------------
+#include "wx/rawbmp.h"

// frame constructor
MyFrame::MyFrame(const wxString& title)
@@ -178,6 +179,116 @@ MyFrame::MyFrame(const wxString& title)
CreateStatusBar(2);
SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR
+ int w = 64;
+ int h = 64;
+
+#if defined(__WXOSX__)
+ wxBitmap bmask(w, h, 1);
+ {
+ wxNativePixelData data(bmask);
+ wxNativePixelData::Iterator p(data);
+ for ( int y = 0; y < h; y++ )
+ {
+ unsigned char c = y < h / 2 ? 255 : 0;
+ wxNativePixelData::Iterator rowStart = p;
+ for ( int x = 0; x < w; x++, ++p )
+ {
+ p.Red() = p.Green() = p.Blue() = c;
+ }
+ p = rowStart;
+ p.OffsetY(data, 1);
+ }
+ }
+#else
+ wxBitmap bmask(w, h, 1);
+ {
+ wxMemoryDC dc(bmask);
+ dc.SetBackground(*wxBLACK_BRUSH);
+ dc.Clear();
+ dc.SetPen(*wxWHITE_PEN);
+ dc.SetBrush(*wxWHITE_BRUSH);
+ dc.DrawRectangle(0, 0, w, h / 2);
+ }
+#endif
+
+ wxBitmap bmpAlpha(w, h, 32);
+#if defined(__WXMSW__) || defined(__WXOSX__)
+ bmpAlpha.UseAlpha();
+#endif
+ {
+ wxAlphaPixelData data(bmpAlpha);
+ wxAlphaPixelData::Iterator p(data);
+ for ( int y = 0; y < h; y++ )
+ {
+ wxAlphaPixelData::Iterator rowStart = p;
+ for ( int x = 0; x < w; x++, ++p )
+ {
+ p.Red() = p.Blue() = 0;
+#if defined(__WXMSW__) || defined(__WXOSX__)
+ p.Green() = p.Alpha() = x < w / 2 ? 255 : 92;
+#else
+ p.Green() = 255;
+ p.Alpha() = x < w / 2 ? 255 : 92;
+#endif
+ }
+ p = rowStart;
+ p.OffsetY(data, 1);
+ }
+ }
+ wxASSERT(bmpAlpha.HasAlpha());
+ wxASSERT(!bmpAlpha.GetMask());
+ wxBitmap bmpAlphaMasked(bmpAlpha);
+ bmpAlphaMasked.SetMask(new wxMask(bmask));
+ wxASSERT(bmpAlphaMasked.HasAlpha());
+ wxASSERT(bmpAlphaMasked.GetMask());
+
+ wxBitmap bmp(w, h, 24);
+ {
+ wxMemoryDC dc(bmp);
+ dc.SetPen(*wxBLUE_PEN);
+ dc.SetBrush(*wxBLUE_BRUSH);
+ dc.DrawRectangle(0, 0, w / 2, h);
+ dc.SetPen(*wxRED_PEN);
+ dc.SetBrush(*wxRED_BRUSH);
+ dc.DrawRectangle(w / 2, 0, w / 2, h);
+ }
+ wxASSERT(!bmp.HasAlpha());
+ wxASSERT(!bmp.GetMask());
+ wxBitmap bmpMasked(bmp);
+ bmpMasked.SetMask(new wxMask(bmask));
+ wxASSERT(!bmpMasked.HasAlpha());
+ wxASSERT(bmpMasked.GetMask());
+
+ wxBitmap bmpOut(300, 200, 24);
+ {
+ wxMemoryDC dc(bmpOut);
+ dc.SetBackground(*wxGREY_BRUSH);
+ dc.Clear();
+
+ dc.DrawBitmap(bmpAlpha, wxPoint(20, 20), true);
+ dc.DrawBitmap(bmask, wxPoint(110, 20), true);
+ dc.DrawBitmap(bmpAlphaMasked, wxPoint(200, 20), true);
+
+ dc.DrawBitmap(bmp, wxPoint(20, 110), true);
+ dc.DrawBitmap(bmask, wxPoint(110, 110), true);
+ dc.DrawBitmap(bmpMasked, wxPoint(200, 110), true);
+ }
+
+ wxPanel* p = new wxPanel(this);
+
+ new wxStaticText(p, wxID_ANY, "bitmap", wxPoint(20, 0));
+ new wxStaticText(p, wxID_ANY, "mask", wxPoint(110, 0));
+ new wxStaticText(p, wxID_ANY, "bitmap+mask", wxPoint(200, 0));
+
+ new wxStaticBitmap(p, wxID_ANY, bmpAlpha, wxPoint(20, 20));
+ new wxStaticBitmap(p, wxID_ANY, bmask, wxPoint(110, 20));
+ new wxStaticBitmap(p, wxID_ANY, bmpAlphaMasked, wxPoint(200, 20));
+
+ new wxStaticBitmap(p, wxID_ANY, bmp, wxPoint(20, 110));
+ new wxStaticBitmap(p, wxID_ANY, bmask, wxPoint(110, 110));
+ new wxStaticBitmap(p, wxID_ANY, bmpMasked, wxPoint(200, 110));
+
+ new wxStaticBitmap(p, wxID_ANY, bmpOut, wxPoint(0, 200));
}
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498>

wxTrac

unread,
Sep 10, 2019, 5:27:35 PM9/10/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------
Changes (by awi):

* Attachment "bitmap_mask_MSW.png" added.

Bitmap with alpha channel and mask (MSW).

wxTrac

unread,
Sep 10, 2019, 5:27:50 PM9/10/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------
Changes (by awi):

* Attachment "bitmap_mask_GTK.png" added.

Bitmap with alpha channel and mask (GTK).

wxTrac

unread,
Sep 10, 2019, 5:28:04 PM9/10/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------
Changes (by awi):

* Attachment "bitmap_mask_OSX.png" added.

Bitmap with alpha channel and mask (OSX).

wxTrac

unread,
Sep 10, 2019, 6:43:17 PM9/10/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------
Changes (by vadz):

* status: new => confirmed


Comment:

This is definitely a problem, but I'm at least as worried by all these
`defined(__WXMSW__) || defined(__WXOSX__)` checks in the test code -- are
they really necessary? If so, this seems like an almost even bigger
problem...

I.e. why can't we initialize the mask using raw bitmap access with wxGTK?
And it looks like we're not using premultiplied alpha in wxGTK?

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:1>

wxTrac

unread,
Sep 11, 2019, 8:21:03 AM9/11/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------

Comment (by awi):

I'm afraid these conditional blocks for `wxMSW`, `wxOSX` are necessary due
to the `wxBitmap` implementation nuances:
1. Under `wxGTK` 32 bpp bitmaps are ARGB by defualt. Under `wxMSW` and
`wxOSX` 32 bpp bitmap can be either ARGB or 0RGB (`wxMSW`) or xRGB
(`wxOSX`) so on these platforms there is necessary to additionally call
`UseAlpha()` if we want to mark 32 bpp bitmap as ARGB.
2. Under `wxGTK` ARGB `wxBitmap` pixel data are stored in non-
premultiplied format but under `wxMSW` and `wxOSX` pixel data are pre-
multiplied so every manipulation of to the raw ARGB data with
`wxAlphaPixelData` has to be done in a different way under these
platforms.
3. Under `wxOSX` all `wxBitmaps` are 32 bpp so even B/W masks are 32 bpp
xRGB bitmaps. Unfortunately, creating a bitmap mask programmatically by
e.g. drawing black and white shapes on `wxMemoryDC` doesn't actually
produce a really monochrome B/W bitmap due to the active antialising in
the backend CG layer. Some gray pixels are produced and it is hard to use
such bitmap as a mask (there are warning raised while creating a mask from
such bitmap). So under `wxOSX` the alternative way to create really
monochrome bitmaps is to manipulate pixel data directly with
`wxNativePixelData`.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:2>

wxTrac

unread,
Sep 16, 2019, 12:38:16 PM9/16/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------

Comment (by Artur Wieczorek <artwik@…>):

In [changeset:"64a08c0c9a463f39122e8762ef190e3a424d93d7/git-wxWidgets"
64a08c0c9/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="64a08c0c9a463f39122e8762ef190e3a424d93d7"
Fix converting wxBitmap with alpha channel and mask to wxIcon

For bitmap with both alpha channel and mask we have to apply mask on our
own because 32 bpp icons don't work properly with mask bitmaps. To do so
we will create a temporary bitmap with copy of RGB data and with alpha
channel being a superposition of the original alpha values and the mask.

See #18498.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:4>

wxTrac

unread,
Sep 16, 2019, 12:38:16 PM9/16/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------

Comment (by Artur Wieczorek <artwik@…>):

In [changeset:"2d15218c9db91d348e8c3a1c8e4a2a968bf3c70a/git-wxWidgets"
2d15218c9/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="2d15218c9db91d348e8c3a1c8e4a2a968bf3c70a"
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.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:3>

wxTrac

unread,
Sep 16, 2019, 1:15:02 PM9/16/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------

Comment (by awi):

Now it looks good under `wxMSW`:
[[Image(bitmap_mask_MSW_fixed.png)]]

But unfortunately `wxGTK2` seems to be affected:
[[Image(bitmap_mask_GTK2.png)]]

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:5>

wxTrac

unread,
Sep 16, 2019, 1:15:44 PM9/16/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------
Changes (by awi):

* Attachment "bitmap_mask_MSW_fixed.png" added.

Bitmap with alpha channel and mask (MSW) - fixed.

wxTrac

unread,
Sep 16, 2019, 1:16:04 PM9/16/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------
Changes (by awi):

* Attachment "bitmap_mask_GTK2.png" added.

Bitmap with alpha channel and mask (GTK2).

wxTrac

unread,
Sep 16, 2019, 2:50:03 PM9/16/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------

Comment (by Artur Wieczorek <artwik@…>):

In [changeset:"992b594c15dd2f6fa28f46464ea2499254ede084/git-wxWidgets"
992b594c1/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="992b594c15dd2f6fa28f46464ea2499254ede084"
Fix creating CGImage from bitmap data

Alpha channel values of created CGImage should be
a superposition of the actual alpha channel values
and bitmap mask (if exists).

See #18498.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:6>

wxTrac

unread,
Sep 16, 2019, 2:57:56 PM9/16/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------

Comment (by awi):

Test under `wxOSX` with fix applied:
[[Image(bitmap_mask_OSX_fixed.png)]]

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:7>

wxTrac

unread,
Sep 16, 2019, 2:58:46 PM9/16/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------
Changes (by awi):

* Attachment "bitmap_mask_OSX_fixed.png" added.

Bitmap with alpha channel and mask (OSX) - fixed.

wxTrac

unread,
Sep 18, 2019, 7:03:33 PM9/18/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+------------------------
Reporter: awi | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+------------------------

Comment (by Artur Wieczorek <artwik@…>):

In [changeset:"f7247086c27626fadf3c5dce43ad0b0bed9a82ee/git-wxWidgets"
f7247086c/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="f7247086c27626fadf3c5dce43ad0b0bed9a82ee"
Fix storing wxBitmap data in GdkPixbuf

Under wxGTK+2 bitmap data with mask and without it (raw) should be stored
in the separate GdkPixbuf buffers - just like it's done in wxGTK+3. These
two buffers are necessary because only GdkPixbuf with raw bitmap data
(original, non-masked) should be copied when wxBitmapRefData instance is
cloned e.g. in SetMask(). GdkPixbuf with masked data is not copied and is
created on first use in wxBitmap::GetPixbuf().

Closes #18508.
See #18498.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:8>

wxTrac

unread,
Sep 18, 2019, 7:03:34 PM9/18/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+----------------------------------------
Reporter: awi | Owner: Artur Wieczorek <artwik@…>
Type: defect | Status: closed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+----------------------------------------
Changes (by Artur Wieczorek <artwik@…>):

* status: confirmed => closed
* owner: => Artur Wieczorek <artwik@…>
* resolution: => fixed


Comment:

In [changeset:"919a4ec702dea1d42609e5f008498ce431e28660/git-wxWidgets"
919a4ec70/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="919a4ec702dea1d42609e5f008498ce431e28660"
Fix drawing wxBitmap with mask

Under wxGTK+2, when wxBitmap has a wxMask but this mask shouldn't be used
in the actual drawing (useMask parameter in wxDC::DrawBitmap() is set to
false), we need to get bitmap data from the buffer with raw (original,
non-masked) data and not from the buffer containing data with mask
applied.

Close #18498.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:9>

wxTrac

unread,
Sep 18, 2019, 7:28:50 PM9/18/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+----------------------------------------
Reporter: awi | Owner: Artur Wieczorek <artwik@…>
Type: defect | Status: closed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+----------------------------------------

Comment (by awi):

Test under `wxGTK2` after the fixup:
[[Image(bitmap_mask_GTK2_fixed.png)]]

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:10>

wxTrac

unread,
Sep 18, 2019, 7:29:29 PM9/18/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+----------------------------------------
Reporter: awi | Owner: Artur Wieczorek <artwik@…>
Type: defect | Status: closed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+----------------------------------------
Changes (by awi):

* Attachment "bitmap_mask_GTK2_fixed.png" added.

Bitmap with alpha channel and mask (GTK2) - fixed.

wxTrac

unread,
Oct 5, 2019, 6:36:45 PM10/5/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+----------------------------------------
Reporter: awi | Owner: Artur Wieczorek <artwik@…>
Type: defect | Status: closed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+----------------------------------------

Comment (by Artur Wieczorek <artwik@…>):

In [changeset:"f7247086c27626fadf3c5dce43ad0b0bed9a82ee/git-wxWidgets"
f7247086c/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="f7247086c27626fadf3c5dce43ad0b0bed9a82ee"
Fix storing wxBitmap data in GdkPixbuf

Under wxGTK+2 bitmap data with mask and without it (raw) should be stored
in the separate GdkPixbuf buffers - just like it's done in wxGTK+3. These
two buffers are necessary because only GdkPixbuf with raw bitmap data
(original, non-masked) should be copied when wxBitmapRefData instance is
cloned e.g. in SetMask(). GdkPixbuf with masked data is not copied and is
created on first use in wxBitmap::GetPixbuf().

Closes #18508.
See #18498.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:11>

wxTrac

unread,
Oct 5, 2019, 6:36:46 PM10/5/19
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+----------------------------------------
Reporter: awi | Owner: Artur Wieczorek <artwik@…>
Type: defect | Status: closed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+----------------------------------------

Comment (by Artur Wieczorek <artwik@…>):

In [changeset:"919a4ec702dea1d42609e5f008498ce431e28660/git-wxWidgets"
919a4ec70/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="919a4ec702dea1d42609e5f008498ce431e28660"
Fix drawing wxBitmap with mask

Under wxGTK+2, when wxBitmap has a wxMask but this mask shouldn't be used
in the actual drawing (useMask parameter in wxDC::DrawBitmap() is set to
false), we need to get bitmap data from the buffer with raw (original,
non-masked) data and not from the buffer containing data with mask
applied.

Close #18498.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:12>

wxTrac

unread,
Apr 7, 2021, 6:26:39 PM4/7/21
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+----------------------------------------
Reporter: awi | Owner: Artur Wieczorek <artwik@…>
Type: defect | Status: closed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+----------------------------------------

Comment (by Artur Wieczorek <artwik@…>):

In [changeset:"c97bec76b8ff353bc1b3c2d9840eccc3ecef1ef7/git-wxWidgets"
c97bec76/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="c97bec76b8ff353bc1b3c2d9840eccc3ecef1ef7"
Fix converting wxBitmap to wxImage (wxGTK2)

Since f7247086c2 ("Fix storing wxBitmap data in GdkPixbuf", 2019-09-18),
919a4ec702 ("Fix drawing wxBitmap with mask", 2019-09-18) and other
commits (see #18498, #18508) RGBA wxBitmaps with masks are drawn properly
under wxGTK2 so only wxBitmap raw RGBA data should be transferred to
wxImage RGBA data because mask is stored in the target wxImage separately.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:13>

wxTrac

unread,
Apr 7, 2021, 6:26:40 PM4/7/21
to wx-...@googlegroups.com
#18498: wxBitmaps with alpha channel and mask are drawn differently under diffrent
platforms
----------------------+----------------------------------------
Reporter: awi | Owner: Artur Wieczorek <artwik@…>
Type: defect | Status: closed
Priority: normal | Milestone:
Component: GUI-all | Version: dev-latest
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Patch: 0 |
----------------------+----------------------------------------

Comment (by Artur Wieczorek <artwik@…>):

In [changeset:"5e8bb6f2e7243fd3814ec570ef2807e42e74b4a9/git-wxWidgets"
5e8bb6f2e/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="5e8bb6f2e7243fd3814ec570ef2807e42e74b4a9"
Fix converting wxImage with alpha channel and mask to wxBitmap (wxGTK2)

Since f7247086c2 ("Fix storing wxBitmap data in GdkPixbuf", 2019-09-18),
919a4ec702 ("Fix drawing wxBitmap with mask", 2019-09-18) and other
commits (see #18498, #18508) RGBA wxBitmaps with masks are drawn properly
under wxGTK2 so if source wxImage has both alpha channel and a mask
the target wxBitmap also should have both components.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/18498#comment:14>
Reply all
Reply to author
Forward
0 new messages