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