]>
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 | |
9 | %% License: wxWindows license | |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
11 | ||
12 | \section{\class{wxBufferedDC}}\label{wxbuffereddc} | |
13 | ||
14 | This simple class provides a simple way to avoid flicker: when drawing on it, | |
15 | everything is in fact drawn on an in-memory buffer (a | |
16 | \helpref{wxBitmap}{wxbitmap}) and copied to the screen only once, when this | |
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 | ||
26 | \helpref{wxMemoryDC}{wxmemorydc} | |
27 | \helpref{wxDC}{wxdc} | |
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 | ||
41 | \membersection{wxBufferedDC::wxBufferedDC}\label{wxbufferedtdcctor} | |
42 | ||
43 | \func{}{wxBufferedDC}{\void} | |
44 | ||
45 | \func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{flags}} | |
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 | |
50 | \helpref{Init}{wxbufferedtdcinit} methods later in order to use the object. | |
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 | |
58 | flushed to this DC when this object is destroyed.} | |
59 | ||
60 | \docparam{area}{The size of the bitmap to be used for buffering (this bitmap is | |
61 | created internally when it is not given explicitely).} | |
62 | ||
63 | \docparam{flags}{Can currently only include the flag | |
64 | \texttt{wxBUFFER\_DC\_PRESERVE\_BG} which means that the existing background | |
65 | of \arg{dc} must be copied to this object before doing anything else, otherwise | |
66 | the background is overwritten (which is more efficient).} | |
67 | ||
68 | \docparam{buffer}{Explicitly provided bitmap to be used for buffering: this is | |
69 | the most efficient solution as the bitmap doesn't have to be recreated each | |
70 | time but it also requires more memory as the bitmap is never freed. The bitmap | |
71 | should have appropriate size, anything drawn outside of its bounds is clipped.} | |
72 | ||
73 | ||
74 | \membersection{wxBufferedDC::Init}\label{wxbufferedtdcinit} | |
75 | ||
76 | \func{void}{Init}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{flags}} | |
77 | ||
78 | \func{void}{Init}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}} | |
79 | ||
80 | These functions initialize the object created using the default constructor. | |
81 | Please see \helpref{constructors documentation}{wxbufferedtdcctor} for details. | |
82 | ||
83 | ||
84 | % VZ: UnMask() intentionally not documented, we might want to make it private | |
85 | ||
86 | ||
87 | \membersection{wxBufferedDC::\destruct{wxBufferedDC}}\label{wxbuffereddcdtor} | |
88 | ||
89 | Copies everything drawn on the DC so far to the underlying DC associated with | |
90 | this object. | |
91 | ||
92 | ||
93 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
94 | ||
95 | \section{\class{wxBufferedPaintDC}}\label{wxbufferedpaintdc} | |
96 | ||
97 | This is a subclass of \helpref{wxBufferedDC}{wxbuffereddc} which can be used | |
98 | inside \texttt{OnPaint()} handler. Just create an object of this class instead | |
99 | of \helpref{wxPaintDC}{wxpaintdc} and that's all you have to do to (mostly) | |
100 | avoid flicker. The only thing to watch out for is that if you are using this | |
101 | class together with \helpref{wxScrolledWindow}{wxscrolledwindow}, you probably | |
102 | do \textbf{not} want to call \helpref{PrepareDC}{wxwindowpreparedc} on it as it | |
103 | already does this internally for the real underlying wxPaintDC. | |
104 | ||
105 | \wxheading{Derived from} | |
106 | ||
107 | \helpref{wxMemoryDC}{wxmemorydc} | |
108 | \helpref{wxDC}{wxdc} | |
109 | \helpref{wxObject}{wxobject} | |
110 | ||
111 | \wxheading{Include files} | |
112 | ||
113 | <wx/dcbuffer.h> | |
114 | ||
115 | ||
116 | \latexignore{\rtfignore{\wxheading{Members}}} | |
117 | ||
118 | \membersection{wxBufferedPaintDC::wxBufferedPaintDC}\label{wxbufferedpaintdcctor} | |
119 | ||
120 | \func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{int }{flags}} | |
121 | ||
122 | \func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{const wxBitmap\& }{buffer}} | |
123 | ||
124 | As with \helpref{wxBufferedDC}{wxbuffereddcctor}, you may either provide the | |
125 | bitmap to be used for buffering or let this object create one internally (in | |
126 | the latter case, the size of the client part of the window is used). | |
127 | ||
128 | ||
129 | \membersection{wxBufferedPaintDC::\destruct{wxBufferedPaintDC}}\label{wxbufferedpaintdcdtor} | |
130 | ||
131 | Copies everything drawn on the DC so far to the window associated with this | |
132 | object. | |
133 | ||
134 |