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