Anti-aliased graphics - recommendations?

Ole Nielsby ole.nielsby at tekare-you-spamminglogisk.dk
Tue Sep 18 07:19:30 PDT 2007


Stefan Csomor <csomor at advancedconcepts.ch> coded:

> void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event))
> {
>    wxPaintDC pdc(this);
>
>     wxGCDC gdc( pdc ) ;
>    PrepareDC(dc);
>
> or not needing the wxGCDC at all have the wxGraphicsContext::Create( pdc ) 
> directly after the wxPaintDC is created

Thanks - this also works with double buffering.

It is not obvious from the docs that wxAutoBufferedPaintDC can be used with
wxGraphicsContext::Create. On GTK/OS X, it works because the class is an
alias for wxPaint, In MSW it will work because it's an alias for 
wxBufferedPaintDC
which inherits from wxMemoryDC which is accepted by an undocumented
MSW-only wxGraphicsContext::Create variant.

(There would be no need to document this if wxGraphicsContext::Create()
would accept a wxDC in general - or if the wxWindow::IsDoubleBuffered()
property had a setter ;-)










More information about the wx-users mailing list