]>
Commit | Line | Data |
---|---|---|
d6af57d4 VZ |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: bufferdc.tex | |
3 | %% Purpose: wxBufferedDC documentation | |
4 | %% Author: Vadim Zeitlin | |
5 | %% Modified by: | |
6 | %% Created: 07.02.04 | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) 2004 Vadim Zeitlin | |
fc2171bd | 9 | %% License: wxWidgets license |
d6af57d4 VZ |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
11 | ||
12 | \section{\class{wxBufferedDC}}\label{wxbuffereddc} | |
13 | ||
14 | This simple class provides a simple way to avoid flicker: when drawing on it, | |
7775e41f RD |
15 | everything is in fact first drawn on an in-memory buffer (a |
16 | \helpref{wxBitmap}{wxbitmap}) and then copied to the screen only once, when this | |
d6af57d4 VZ |
17 | object is destroyed. |
18 | ||
19 | It can be used in the same way as any other device context. wxBufferedDC itself | |
20 | typically replaces \helpref{wxClientDC}{wxclientdc}, if you want to use it in | |
21 | your \texttt{OnPaint()} handler, you should look at | |
22 | \helpref{wxBufferedPaintDC}{wxbufferedpaintdc}. | |
23 | ||
24 | \wxheading{Derived from} | |
25 | ||
14c7f3dd VZ |
26 | \helpref{wxMemoryDC}{wxmemorydc}\\ |
27 | \helpref{wxDC}{wxdc}\\ | |
d6af57d4 VZ |
28 | \helpref{wxObject}{wxobject} |
29 | ||
30 | \wxheading{Include files} | |
31 | ||
32 | <wx/dcbuffer.h> | |
33 | ||
34 | \wxheading{See also} | |
35 | ||
36 | \helpref{wxDC}{wxdc} | |
37 | ||
38 | ||
39 | \latexignore{\rtfignore{\wxheading{Members}}} | |
40 | ||
461fb267 | 41 | \membersection{wxBufferedDC::wxBufferedDC}\label{wxbuffereddcctor} |
d6af57d4 VZ |
42 | |
43 | \func{}{wxBufferedDC}{\void} | |
44 | ||
7775e41f | 45 | \func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}} |
d6af57d4 VZ |
46 | |
47 | \func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}} | |
48 | ||
49 | If you use the first, default, constructor, you must call one of the | |
461fb267 | 50 | \helpref{Init}{wxbuffereddcinit} methods later in order to use the object. |
d6af57d4 VZ |
51 | |
52 | The other constructors initialize the object immediately and \texttt{Init()} | |
53 | must not be called after using them. | |
54 | ||
55 | \wxheading{Parameters} | |
56 | ||
57 | \docparam{dc}{The underlying DC: everything drawn to this object will be | |
7775e41f RD |
58 | flushed to this DC when this object is destroyed. You may pass NULL |
59 | in order to just initialize the buffer, and not flush it.} | |
d6af57d4 VZ |
60 | |
61 | \docparam{area}{The size of the bitmap to be used for buffering (this bitmap is | |
dbd94b75 | 62 | created internally when it is not given explicitly).} |
d6af57d4 | 63 | |
d6af57d4 VZ |
64 | \docparam{buffer}{Explicitly provided bitmap to be used for buffering: this is |
65 | the most efficient solution as the bitmap doesn't have to be recreated each | |
66 | time but it also requires more memory as the bitmap is never freed. The bitmap | |
67 | should have appropriate size, anything drawn outside of its bounds is clipped.} | |
68 | ||
69 | ||
461fb267 | 70 | \membersection{wxBufferedDC::Init}\label{wxbuffereddcinit} |
d6af57d4 | 71 | |
7775e41f | 72 | \func{void}{Init}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}} |
d6af57d4 VZ |
73 | |
74 | \func{void}{Init}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}} | |
75 | ||
76 | These functions initialize the object created using the default constructor. | |
461fb267 | 77 | Please see \helpref{constructors documentation}{wxbuffereddcctor} for details. |
d6af57d4 VZ |
78 | |
79 | ||
80 | % VZ: UnMask() intentionally not documented, we might want to make it private | |
81 | ||
82 | ||
83 | \membersection{wxBufferedDC::\destruct{wxBufferedDC}}\label{wxbuffereddcdtor} | |
84 | ||
85 | Copies everything drawn on the DC so far to the underlying DC associated with | |
7775e41f | 86 | this object, if any. |
d6af57d4 VZ |
87 | |
88 | ||
89 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
90 | ||
91 | \section{\class{wxBufferedPaintDC}}\label{wxbufferedpaintdc} | |
92 | ||
93 | This is a subclass of \helpref{wxBufferedDC}{wxbuffereddc} which can be used | |
7775e41f | 94 | inside of an \texttt{OnPaint()} event handler. Just create an object of this class instead |
d6af57d4 VZ |
95 | of \helpref{wxPaintDC}{wxpaintdc} and that's all you have to do to (mostly) |
96 | avoid flicker. The only thing to watch out for is that if you are using this | |
97 | class together with \helpref{wxScrolledWindow}{wxscrolledwindow}, you probably | |
461fb267 | 98 | do \textbf{not} want to call \helpref{PrepareDC}{wxscrolledwindowpreparedc} on it as it |
d6af57d4 VZ |
99 | already does this internally for the real underlying wxPaintDC. |
100 | ||
101 | \wxheading{Derived from} | |
102 | ||
14c7f3dd VZ |
103 | \helpref{wxMemoryDC}{wxmemorydc}\\ |
104 | \helpref{wxDC}{wxdc}\\ | |
d6af57d4 VZ |
105 | \helpref{wxObject}{wxobject} |
106 | ||
107 | \wxheading{Include files} | |
108 | ||
109 | <wx/dcbuffer.h> | |
110 | ||
111 | ||
112 | \latexignore{\rtfignore{\wxheading{Members}}} | |
113 | ||
114 | \membersection{wxBufferedPaintDC::wxBufferedPaintDC}\label{wxbufferedpaintdcctor} | |
115 | ||
7775e41f | 116 | \func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{const wxBitmap\& }{buffer = wxNullBitmap}} |
d6af57d4 VZ |
117 | |
118 | As with \helpref{wxBufferedDC}{wxbuffereddcctor}, you may either provide the | |
119 | bitmap to be used for buffering or let this object create one internally (in | |
120 | the latter case, the size of the client part of the window is used). | |
121 | ||
122 | ||
123 | \membersection{wxBufferedPaintDC::\destruct{wxBufferedPaintDC}}\label{wxbufferedpaintdcdtor} | |
124 | ||
125 | Copies everything drawn on the DC so far to the window associated with this | |
7775e41f | 126 | object, using a \helpref{wxPaintDC}{wxpaintdc}. |
d6af57d4 VZ |
127 | |
128 |