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