[wx2.8.0, wxGTK, gcc4.1.2] wxDC::Blit() and wxMask again

Vadim Zeitlin vadim at wxwindows.org
Mon Jan 29 04:32:11 PST 2007


On Mon, 29 Jan 2007 11:09:18 +0100 Kövesdi György <kgy at deverto.hu> wrote:

KG> I tried to put the SetMask() function call before the SelectObject() function, 
KG> so the source is:
KG> 
KG>          wxMemoryDC mdc;
KG>          wxBitmap bm(100, 100);
KG>          bm.SetMask(new wxMask(bm, *wxBLUE));
KG>          mdc.SelectObject(bm);
KG>          mdc.SetBackground(*wxBLUE_BRUSH);
KG>          mdc.SetPen(wxPen(wxColour(0, 0, 0), 8));
KG>          mdc.Clear();
KG>          mdc.DrawLine(5, 5, 20, 20);
...
KG> Funny thing happened: the result is sometimes good, and sometimes bad with the 
KG> version 2.8.0. Starting the ./controls program the background is sometimes 
KG> blue, sometimes green, and there is a noise in very few cases. I think there 
KG> must be something uninitialized.

 Yes: the bitmap contents. You must clear it before setting the mask, its
initial content is random.

 Regards,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/





More information about the wx-users mailing list