Contents Up Previous Next

wxBufferedDC

This simple class provides a simple way to avoid flicker: when drawing on it, everything is in fact first drawn on an in-memory buffer (a wxBitmap) and then copied to the screen only once, when this object is destroyed.

It can be used in the same way as any other device context. wxBufferedDC itself typically replaces wxClientDC, if you want to use it in your OnPaint() handler, you should look at wxBufferedPaintDC or wxAutoBufferedPaintDC.

Please note that GTK+ 2.0 as well as OS X provide double buffering themselves natively. wxBufferedDC is aware of this however, and will bypass the buffering unless explicit buffer bitmap is given.

Derived from

wxDC
wxObject

Include files

<wx/dcbuffer.h>

See also

wxDC, wxMemoryDC, wxBufferedPaintDC, wxAutoBufferedPaintDC

Members

wxBufferedDC::wxBufferedDC
wxBufferedDC::Init
wxBufferedDC::~wxBufferedDC


wxBufferedDC::wxBufferedDC

wxBufferedDC()

wxBufferedDC(wxDC *dc, const wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA)

wxBufferedDC(wxWindow*window, wxDC *dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA)

If you use the first, default, constructor, you must call one of the Init methods later in order to use the object.

The other constructors initialize the object immediately and Init() must not be called after using them.

Parameters

dc

window

area

buffer

style


wxBufferedDC::Init

void Init(wxDC *dc, const wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA)

void Init(wxWindow*window, wxDC *dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA)

These functions initialize the object created using the default constructor. Please see constructors documentation for details.


wxBufferedDC::~wxBufferedDC

Copies everything drawn on the DC so far to the underlying DC associated with this object, if any.