chess
Volker Bartheld
dr_versaeg at freenet.de
Fri Oct 19 00:56:49 PDT 2007
Hi!
>>>> You might want to rescale the bitmaps with wxImage::Resize()
>>>> (http://www.wxwidgets.org/manuals/stable/wx_wximage.html#wximageresize) to
>>>> the size you need
Sizing a Bitmap is as simple as this:
wxBitmap Scale(const wxBitmap& bmp, wxSize size)
{
wxImage img=bmp.ConvertToImage();
return wxBitmap(img.Scale(size.GetWidth(), size.GetHeight()));
}
>>>>or alternatively switch to a TTF-font with chess figures
>>>> using wxDC::DrawText() and rely on the OS's scaling functions.
Creating texts of different size works with wxDC::SetFont() using wxFont's
c'tor (http://www.wxwidgets.org/manuals/stable/wx_wxfont.html#wxfontctor)
that allows specifying various parameters incl. the (pixel) size.
>>>> Another
>>>> solution would be a temporary wxMemoryDC and then wxDC::Blit()
>>>> (http://www.wxwidgets.org/manuals/stable/wx_wxdc.html#wxdcblit) which
>>>> usually is hardware-supported and therefore pretty fast.
For wxDC::Blit() you can specify target coordinates, along with target
width and target height. If h/w-values are not identical to those
originally in the source DC, then the DC is scaled to fit.
> ok. thanks sugestions "read the tutorial ;)"
That indeed helps. The wxWidgets learning curve is a bit steep but at least
there's a comprehensive manual, plenty of samples and a healthy community.
Imagine trying to create an MS Exchange Client Extension with a set of
custom filter rules on the server that also programmatically installs a
mail account with username & password on MS Outlook. Don't ask why I chose
this example.
Good luck.
Volker
--
mailto: V B A R T H E L D at G M X dot D E
More information about the wx-users
mailing list