wx2.8.0: wxDC::Blit() and wxMask
Kövesdi György
kgy at deverto.hu
Fri Jan 26 00:56:39 PST 2007
Hi,
My application needs the transparent bitmaps which I tried to use according to
the documentation. It was good up to the version 2.6.3.
I created the following test code:
wxMemoryDC mdc;
wxBitmap bm(100, 100);
mdc.SelectObject(bm);
mdc.SetBackground(*wxBLUE_BRUSH);
mdc.SetPen(wxPen(wxColour(0, 0, 0), 8));
mdc.Clear();
mdc.DrawLine(5, 5, 20, 20);
bm.SetMask(new wxMask(bm, *wxBLUE));
wxBitmap bm2(100, 100);
wxMemoryDC dc2;
dc2.SelectObject(bm2);
dc2.SetBackground(*wxGREEN_BRUSH);
dc2.Clear();
dc2.Blit(0, 0, 100, 100, &mdc, 0, 0, wxCOPY, true);
dc2.SelectObject(wxNullBitmap);
mdc.SelectObject(wxNullBitmap);
(void)new wxStaticBitmap(panel, wxID_ANY, bm2, wxPoint(300, 120));
This can be pasted into the file samples/controls/controls.cpp (at line 974 in
2.8.0, or at line 981 in 2.6.3). In my mind this code must draw a black line
on a green background, which is the result in 2.6.3. In the version 2.6.8 the
background is blue, which means the wxDC::Blit() function does not handle the
transparency.
The transparency seems good in other cases mentioned in the sample sources.
Regards
Gyorgy Kovesdi
More information about the wx-users
mailing list