2004-02-07 11:39:26 -05:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%% Name: bufferdc.tex
|
|
|
|
%% Purpose: wxBufferedDC documentation
|
|
|
|
%% Author: Vadim Zeitlin
|
|
|
|
%% Modified by:
|
|
|
|
%% Created: 07.02.04
|
|
|
|
%% RCS-ID: $Id$
|
|
|
|
%% Copyright: (c) 2004 Vadim Zeitlin
|
2005-02-22 10:09:56 -05:00
|
|
|
%% License: wxWindows license
|
2004-02-07 11:39:26 -05:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
\section{\class{wxBufferedDC}}\label{wxbuffereddc}
|
|
|
|
|
|
|
|
This simple class provides a simple way to avoid flicker: when drawing on it,
|
2004-02-21 14:09:59 -05:00
|
|
|
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
|
2004-02-07 11:39:26 -05:00
|
|
|
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
|
2006-10-11 15:06:21 -04:00
|
|
|
\helpref{wxBufferedPaintDC}{wxbufferedpaintdc} or \helpref{wxAutoBufferedPaintDC}{wxautobufferedpaintdc}.
|
2004-02-07 11:39:26 -05:00
|
|
|
|
2006-09-17 07:09:26 -04:00
|
|
|
Please note that GTK+ 2.0 as well as OS X provide double buffering themselves
|
2006-10-13 15:14:21 -04:00
|
|
|
+natively. Use \helpref{wxWindow::IsDoubleBuffered}{wxwindowisdoublebuffered} to
|
|
|
|
+determine whether you need to use buffering or not.
|
2006-09-17 07:09:26 -04:00
|
|
|
|
2004-02-07 11:39:26 -05:00
|
|
|
\wxheading{Derived from}
|
|
|
|
|
2006-10-13 15:14:21 -04:00
|
|
|
\helpref{wxMemoryDC}{wxmemorydc}\\
|
2004-02-08 13:56:27 -05:00
|
|
|
\helpref{wxDC}{wxdc}\\
|
2004-02-07 11:39:26 -05:00
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/dcbuffer.h>
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
2006-10-11 15:06:21 -04:00
|
|
|
\helpref{wxDC}{wxdc},\rtfsp
|
|
|
|
\helpref{wxMemoryDC}{wxmemorydc},\rtfsp
|
|
|
|
\helpref{wxBufferedPaintDC}{wxbufferedpaintdc},\rtfsp
|
|
|
|
\helpref{wxAutoBufferedPaintDC}{wxautobufferedpaintdc}
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-02-08 13:48:55 -05:00
|
|
|
\membersection{wxBufferedDC::wxBufferedDC}\label{wxbuffereddcctor}
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
\func{}{wxBufferedDC}{\void}
|
|
|
|
|
2006-10-13 15:14:21 -04:00
|
|
|
\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
2004-02-07 11:39:26 -05:00
|
|
|
|
2006-10-13 15:14:21 -04:00
|
|
|
\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
2006-10-11 15:06:21 -04:00
|
|
|
|
2004-02-07 11:39:26 -05:00
|
|
|
If you use the first, default, constructor, you must call one of the
|
2004-02-08 13:48:55 -05:00
|
|
|
\helpref{Init}{wxbuffereddcinit} methods later in order to use the object.
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
The other constructors initialize the object immediately and \texttt{Init()}
|
|
|
|
must not be called after using them.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{dc}{The underlying DC: everything drawn to this object will be
|
2004-02-21 14:09:59 -05:00
|
|
|
flushed to this DC when this object is destroyed. You may pass NULL
|
|
|
|
in order to just initialize the buffer, and not flush it.}
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
\docparam{area}{The size of the bitmap to be used for buffering (this bitmap is
|
2004-10-22 15:15:35 -04:00
|
|
|
created internally when it is not given explicitly).}
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
\docparam{buffer}{Explicitly provided bitmap to be used for buffering: this is
|
|
|
|
the most efficient solution as the bitmap doesn't have to be recreated each
|
|
|
|
time but it also requires more memory as the bitmap is never freed. The bitmap
|
|
|
|
should have appropriate size, anything drawn outside of its bounds is clipped.}
|
|
|
|
|
2005-03-03 01:56:15 -05:00
|
|
|
\docparam{style}{wxBUFFER\_CLIENT\_AREA to indicate that just the client area of
|
|
|
|
the window is buffered, or wxBUFFER\_VIRTUAL\_AREA to indicate that the buffer bitmap
|
|
|
|
covers the virtual area (in which case PrepareDC is automatically called for the actual window
|
|
|
|
device context).}
|
2004-02-07 11:39:26 -05:00
|
|
|
|
2004-02-08 13:48:55 -05:00
|
|
|
\membersection{wxBufferedDC::Init}\label{wxbuffereddcinit}
|
2004-02-07 11:39:26 -05:00
|
|
|
|
2006-10-13 15:14:21 -04:00
|
|
|
\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
2004-02-07 11:39:26 -05:00
|
|
|
|
2006-10-13 15:14:21 -04:00
|
|
|
\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
2006-10-11 15:06:21 -04:00
|
|
|
|
2004-02-07 11:39:26 -05:00
|
|
|
These functions initialize the object created using the default constructor.
|
2004-02-08 13:48:55 -05:00
|
|
|
Please see \helpref{constructors documentation}{wxbuffereddcctor} for details.
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
% VZ: UnMask() intentionally not documented, we might want to make it private
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxBufferedDC::\destruct{wxBufferedDC}}\label{wxbuffereddcdtor}
|
|
|
|
|
|
|
|
Copies everything drawn on the DC so far to the underlying DC associated with
|
2004-02-21 14:09:59 -05:00
|
|
|
this object, if any.
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
\section{\class{wxBufferedPaintDC}}\label{wxbufferedpaintdc}
|
|
|
|
|
|
|
|
This is a subclass of \helpref{wxBufferedDC}{wxbuffereddc} which can be used
|
2004-02-21 14:09:59 -05:00
|
|
|
inside of an \texttt{OnPaint()} event handler. Just create an object of this class instead
|
2006-10-11 15:06:21 -04:00
|
|
|
of \helpref{wxPaintDC}{wxpaintdc} and make sure \helpref{wxWindow::SetBackgroundStyle}{wxwindowgetbackgroundstyle}
|
|
|
|
is called with wxBG\_STYLE\_CUSTOM somewhere in the class initialization code, and that's all
|
|
|
|
you have to do to (mostly) avoid flicker. The only thing to watch out for is that if you are
|
|
|
|
using this class together with \helpref{wxScrolledWindow}{wxscrolledwindow}, you probably
|
2004-02-08 13:48:55 -05:00
|
|
|
do \textbf{not} want to call \helpref{PrepareDC}{wxscrolledwindowpreparedc} on it as it
|
2004-02-07 11:39:26 -05:00
|
|
|
already does this internally for the real underlying wxPaintDC.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
2006-10-11 15:06:21 -04:00
|
|
|
\helpref{wxBufferedDC}{wxbuffereddc}\\
|
2006-10-13 15:14:21 -04:00
|
|
|
\helpref{wxMemoryDC}{wxmemorydc}\\
|
2004-02-08 13:56:27 -05:00
|
|
|
\helpref{wxDC}{wxdc}\\
|
2004-02-07 11:39:26 -05:00
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/dcbuffer.h>
|
|
|
|
|
2006-10-11 15:06:21 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDC}{wxdc},\rtfsp
|
|
|
|
\helpref{wxBufferedDC}{wxbuffereddc},\rtfsp
|
|
|
|
\helpref{wxAutoBufferedPaintDC}{wxautobufferedpaintdc}
|
|
|
|
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxBufferedPaintDC::wxBufferedPaintDC}\label{wxbufferedpaintdcctor}
|
|
|
|
|
2005-03-03 01:56:15 -05:00
|
|
|
\func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
|
|
|
|
|
|
|
\func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
As with \helpref{wxBufferedDC}{wxbuffereddcctor}, you may either provide the
|
|
|
|
bitmap to be used for buffering or let this object create one internally (in
|
|
|
|
the latter case, the size of the client part of the window is used).
|
|
|
|
|
2005-03-03 01:56:15 -05:00
|
|
|
Pass wxBUFFER\_CLIENT\_AREA for the {\it style} parameter to indicate that just the client area of
|
|
|
|
the window is buffered, or wxBUFFER\_VIRTUAL\_AREA to indicate that the buffer bitmap
|
|
|
|
covers the virtual area (in which case PrepareDC is automatically called for the actual window
|
|
|
|
device context).
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
\membersection{wxBufferedPaintDC::\destruct{wxBufferedPaintDC}}\label{wxbufferedpaintdcdtor}
|
|
|
|
|
|
|
|
Copies everything drawn on the DC so far to the window associated with this
|
2004-02-21 14:09:59 -05:00
|
|
|
object, using a \helpref{wxPaintDC}{wxpaintdc}.
|
2004-02-07 11:39:26 -05:00
|
|
|
|
|
|
|
|
2006-10-11 15:06:21 -04:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
\section{\class{wxAutoBufferedPaintDC}}\label{wxautobufferedpaintdc}
|
|
|
|
|
|
|
|
This wxDC derivative can be used inside of an \texttt{OnPaint()} event handler to achieve
|
|
|
|
double-buffered drawing. Just create an object of this class instead of \helpref{wxPaintDC}{wxpaintdc}
|
|
|
|
and make sure \helpref{wxWindow::SetBackgroundStyle}{wxwindowgetbackgroundstyle} is called
|
|
|
|
with wxBG\_STYLE\_CUSTOM somewhere in the class initialization code, and that's all you have
|
|
|
|
to do to (mostly) avoid flicker.
|
|
|
|
|
|
|
|
The difference between \helpref{wxBufferedPaintDC}{wxbufferedpaintdc} and this class,
|
|
|
|
is the lightweigthness - on platforms which have native double-buffering, wxAutoBufferedPaintDC is simply
|
|
|
|
a typedef of wxPaintDC. Otherwise, it is a typedef of wxBufferedPaintDC.
|
|
|
|
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxBufferedPaintDC}{wxbufferedpaintdc}\\
|
|
|
|
\helpref{wxPaintDC}{wxpaintdc}\\
|
|
|
|
\helpref{wxDC}{wxdc}\\
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/dcbuffer.h>
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDC}{wxdc},\rtfsp
|
|
|
|
\helpref{wxBufferedPaintDC}{wxbufferedpaintdc}
|
|
|
|
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxAutoBufferedPaintDC::wxAutoBufferedPaintDC}\label{wxautobufferedpaintdcctor}
|
|
|
|
|
|
|
|
\func{}{wxAutoBufferedPaintDC}{\param{wxWindow *}{window}}
|
|
|
|
|
|
|
|
Constructor. Pass a pointer to the window on which you wish to paint.
|
|
|
|
|