]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/memorydc.tex
use explicit virtual keyword with overridden virtual methods
[wxWidgets.git] / docs / latex / wx / memorydc.tex
CommitLineData
a660d684
KB
1\section{\class{wxMemoryDC}}\label{wxmemorydc}
2
41fbc841 3A memory device context provides a means to draw graphics onto a bitmap. When
d17f05af
HH
4drawing in to a mono-bitmap, using {\tt wxWHITE}, {\tt wxWHITE\_PEN} and
5{\tt wxWHITE\_BRUSH}
41fbc841
RR
6will draw the background colour (i.e. 0) whereas all other colours will draw the
7foreground colour (i.e. 1).
a660d684
KB
8
9\wxheading{Derived from}
10
11\helpref{wxDC}{wxdc}\\
12\helpref{wxObject}{wxobject}
13
954b8ae6
JS
14\wxheading{Include files}
15
16<wx/dcmemory.h>
17
a660d684
KB
18\wxheading{Remarks}
19
20A bitmap must be selected into the new memory DC before it may be used
21for anything. Typical usage is as follows:
22
23\begin{verbatim}
24 // Create a memory DC
25 wxMemoryDC temp_dc;
26 temp_dc.SelectObject(test_bitmap);
27
28 // We can now draw into the memory DC...
29 // Copy from this DC to another DC.
30 old_dc.Blit(250, 50, BITMAP_WIDTH, BITMAP_HEIGHT, temp_dc, 0, 0);
31\end{verbatim}
32
33Note that the memory DC {\it must} be deleted (or the bitmap selected out of it) before a bitmap
34can be reselected into another memory DC.
35
36\wxheading{See also}
37
38\helpref{wxBitmap}{wxbitmap}, \helpref{wxDC}{wxdc}
39
40\latexignore{\rtfignore{\wxheading{Members}}}
41
dcbd177f 42\membersection{wxMemoryDC::wxMemoryDC}\label{wxmemorydcctor}
a660d684 43
432efcb0 44\func{}{wxMemoryDC}{\param{const wxBitmap\& }{bitmap = wxNullBitmap}}
a660d684
KB
45
46Constructs a new memory device context.
47
48Use the {\it Ok} member to test whether the constructor was successful
432efcb0
RD
49in creating a usable device context. If you don't pass a valid bitmap
50to the constructor, don't forget to select a bitmap into the DC before
51drawing on it.
a660d684 52
dcbd177f 53\membersection{wxMemoryDC::SelectObject}\label{wxmemorydcselectobject}
a660d684 54
f6e9a818 55\func{void}{SelectObject}{\param{const wxBitmap\& }{bitmap}}
a660d684
KB
56
57Selects the given bitmap into the device context, to use as the memory
58bitmap. Selecting the bitmap into a memory DC allows you to draw into
59the DC (and therefore the bitmap) and also to use {\bf Blit} to copy
fe604ccd 60the bitmap to a window. For this purpose, you may find \helpref{wxDC::DrawIcon}{wxdcdrawicon}\rtfsp
a660d684
KB
61easier to use instead.
62
63If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is selected out of the device
64context, and the original bitmap restored, allowing the current bitmap to
65be destroyed safely.
66