X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3dfd8daff3a78af92b146a79d001a778dcad52b8..c63312c472c83be6d3b935f0ceeef484a7d611ce:/docs/latex/wx/bufferdc.tex diff --git a/docs/latex/wx/bufferdc.tex b/docs/latex/wx/bufferdc.tex index dae455b4c6..903c40d6b4 100644 --- a/docs/latex/wx/bufferdc.tex +++ b/docs/latex/wx/bufferdc.tex @@ -11,22 +11,34 @@ \section{\class{wxBufferedDC}}\label{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 -\helpref{wxBitmap}{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 \helpref{wxClientDC}{wxclientdc}, if you want to use it in -your \texttt{OnPaint()} handler, you should look at -\helpref{wxBufferedPaintDC}{wxbufferedpaintdc} or \helpref{wxAutoBufferedPaintDC}{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. +This class provides a simple way to avoid flicker: when drawing on it, +everything is in fact first drawn on an in-memory buffer (a +\helpref{wxBitmap}{wxbitmap}) and then copied to the screen, using the +associated wxDC, only once, when this object is destroyed. wxBufferedDC itself +is typically associated with \helpref{wxClientDC}{wxclientdc}, if you want to +use it in your \texttt{EVT\_PAINT} handler, you should look at +\helpref{wxBufferedPaintDC}{wxbufferedpaintdc} instead. + +When used like this, a valid \arg{dc} must be specified in the constructor +while the \arg{buffer} bitmap doesn't have to be explicitly provided, by +default this class will allocate the bitmap of required size itself. However +using a dedicated bitmap can speed up the redrawing process by eliminating the +repeated creation and destruction of a possibly big bitmap. Otherwise, +wxBufferedDC can be used in the same way as any other device context. + +There is another possible use for wxBufferedDC is to use it to maintain a +backing store for the window contents. In this case, the associated \arg{dc} +may be \NULL but a valid backing store bitmap should be specified. + +Finally, please note that GTK+ 2.0 as well as OS X provide double buffering +themselves natively. You can either use \helpref{wxWindow::IsDoubleBuffered}{wxwindowisdoublebuffered} +to determine whether you need to use buffering or not, or use +\helpref{wxAutoBufferedPaintDC}{wxautobufferedpaintdc} to avoid needless double +buffering on the systems which already do it automatically. \wxheading{Derived from} +\helpref{wxMemoryDC}{wxmemorydc}\\ \helpref{wxDC}{wxdc}\\ \helpref{wxObject}{wxobject} @@ -48,9 +60,9 @@ unless explicit buffer bitmap is given. \func{}{wxBufferedDC}{\void} -\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}} +\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}} -\func{}{wxBufferedDC}{\param{wxWindow*}{window}, \param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}} +\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}} If you use the first, default, constructor, you must call one of the \helpref{Init}{wxbuffereddcinit} methods later in order to use the object. @@ -64,10 +76,6 @@ must not be called after using them. flushed to this DC when this object is destroyed. You may pass NULL in order to just initialize the buffer, and not flush it.} -\docparam{window}{The window on which the dc paints. May be NULL, but -you should normally specify this so that the DC can be aware whether the -surface is natively double-buffered or not.} - \docparam{area}{The size of the bitmap to be used for buffering (this bitmap is created internally when it is not given explicitly).} @@ -83,9 +91,9 @@ device context).} \membersection{wxBufferedDC::Init}\label{wxbuffereddcinit} -\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}} +\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}} -\func{void}{Init}{\param{wxWindow*}{window}, \param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}} +\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}} These functions initialize the object created using the default constructor. Please see \helpref{constructors documentation}{wxbuffereddcctor} for details. @@ -116,6 +124,7 @@ already does this internally for the real underlying wxPaintDC. \wxheading{Derived from} \helpref{wxBufferedDC}{wxbuffereddc}\\ +\helpref{wxMemoryDC}{wxmemorydc}\\ \helpref{wxDC}{wxdc}\\ \helpref{wxObject}{wxobject}