blurring in bitmap associated to wxMemoryDC

Vadim Zeitlin vadim at wxwindows.org
Sun Mar 4 12:01:14 PST 2007


On Wed, 28 Feb 2007 17:43:22 +0100 Luzyde Team <luzyde at gmail.com> wrote:

LT> I have come across a very strange bug in wxMemoryDC (at least, it seems a
LT> bug) in Windows (I use w2k and XP).
LT> 
LT> It appears when writing text into the bitmap associated to the wxMemoryDC.
LT> 
LT> Depending on the size of the bitmap, and for different combinations of font
LT> style, family and weight the text is completely messed up or rather blurred.
LT> 
LT> You can see the result in the attached jpg.
LT> 
LT> This can be tested with this simple code snippet:
LT> 
LT> 
LT>     wxBitmap bitmap( 824, 2600 );
LT>     wxMemoryDC dc;
LT>     dc.SelectObject( bitmap );
LT>     dc.SetBackground(*wxWHITE);
LT>     dc.Clear();
LT> 
LT>     wxFont font(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
LT> wxFONTWEIGHT_BOLD);
LT>     font.SetFaceName(wxT("arial"));
LT>     dc.SetFont(font);
LT>     for (int i = 0; i<150; i++)
LT>     dc.DrawText( wxT("This is a long sentence as text."), 20, 20+15*i );
LT> 
LT> 
LT>     dc.SelectObject( wxNullBitmap );
LT> 
LT>     bitmap.SaveFile(wxT("test2.bmp"),wxBITMAP_TYPE_BMP);

 I have no idea about what is causing the bug but I can't reproduce it
using this code in the minimal sample under Windows 2003. I don't think the
difference between XP and 2003 can account for this but a bug in video card
driver just might.

 Regards,
VZ

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





More information about the wx-users mailing list