]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/memorydc.tex
Doc updates.
[wxWidgets.git] / docs / latex / wx / memorydc.tex
1 \section{\class{wxMemoryDC}}\label{wxmemorydc}
2
3 A 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{Include files}
11
12 <wx/dcmemory.h>
13
14 \wxheading{Remarks}
15
16 A bitmap must be selected into the new memory DC before it may be used
17 for 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
29 Note that the memory DC {\it must} be deleted (or the bitmap selected out of it) before a bitmap
30 can 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
42 Constructs a new memory device context.
43
44 Use the {\it Ok} member to test whether the constructor was successful
45 in creating a useable device context. Don't forget to select a bitmap
46 into the DC before drawing on it.
47
48 \membersection{wxMemoryDC::SelectObject}
49
50 \func{}{SelectObject}{\param{const wxBitmap\& }{bitmap}}
51
52 Selects the given bitmap into the device context, to use as the memory
53 bitmap. Selecting the bitmap into a memory DC allows you to draw into
54 the DC (and therefore the bitmap) and also to use {\bf Blit} to copy
55 the bitmap to a window. For this purpose, you may find \helpref{wxDC::DrawIcon}{wxdcdrawicon}\rtfsp
56 easier to use instead.
57
58 If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is selected out of the device
59 context, and the original bitmap restored, allowing the current bitmap to
60 be destroyed safely.
61