]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/memorydc.tex
Added EVT_MOVE_START, EVT_MOVE_END (wxMSW only for now)
[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
a7af285d
VZ
18\wxheading{Library}
19
20\helpref{wxCore}{librarieslist}
21
a660d684
KB
22\wxheading{Remarks}
23
24A bitmap must be selected into the new memory DC before it may be used
25for anything. Typical usage is as follows:
26
27\begin{verbatim}
28 // Create a memory DC
29 wxMemoryDC temp_dc;
30 temp_dc.SelectObject(test_bitmap);
31
32 // We can now draw into the memory DC...
33 // Copy from this DC to another DC.
34 old_dc.Blit(250, 50, BITMAP_WIDTH, BITMAP_HEIGHT, temp_dc, 0, 0);
35\end{verbatim}
36
37Note that the memory DC {\it must} be deleted (or the bitmap selected out of it) before a bitmap
38can be reselected into another memory DC.
39
40\wxheading{See also}
41
42\helpref{wxBitmap}{wxbitmap}, \helpref{wxDC}{wxdc}
43
44\latexignore{\rtfignore{\wxheading{Members}}}
45
dcbd177f 46\membersection{wxMemoryDC::wxMemoryDC}\label{wxmemorydcctor}
a660d684 47
fea35690 48\func{}{wxMemoryDC}{\void}
a660d684
KB
49
50Constructs a new memory device context.
51
fea35690
VZ
52Use the \helpref{IsOk}{wxdcisok} member to test whether the constructor was successful
53in creating a usable device context.
54Don't forget to select a bitmap into the DC before drawing on it.
55
56\func{}{wxMemoryDC}{\param{wxBitmap\& }{bitmap}}
57
58Constructs a new memory device context and calls \helpref{SelectObject}{wxmemorydcselectobject}
59with the given bitmap.
60Use the \helpref{IsOk}{wxdcisok} member to test whether the constructor was successful
61in creating a usable device context.
62
a660d684 63
dcbd177f 64\membersection{wxMemoryDC::SelectObject}\label{wxmemorydcselectobject}
a660d684 65
fea35690
VZ
66\func{void}{SelectObject}{\param{wxBitmap\& }{bitmap}}
67
68Works exactly like \helpref{SelectObjectAsSource}{wxmemorydcselectobjectassource} but
69this is the function you should use when you select a bitmap because you want to modify
70it, e.g. drawing on this DC.
71
72Be careful to use this function and not \helpref{SelectObjectAsSource}{wxmemorydcselectobjectassource}
73when you want to modify the bitmap you are selecting otherwise you may incurr in some
74problems related to wxBitmap being a reference counted object
75(see \helpref{reference counting overview}{trefcount}).
76
77\wxheading{See also}
78
79\helpref{wxDC::DrawBitmap}{wxdcdrawbitmap}
80
81
82
83\membersection{wxMemoryDC::SelectObjectAsSource}\label{wxmemorydcselectobjectassource}
84
85\func{void}{SelectObjectAsSource}{\param{const wxBitmap\& }{bitmap}}
a660d684
KB
86
87Selects the given bitmap into the device context, to use as the memory
88bitmap. Selecting the bitmap into a memory DC allows you to draw into
fea35690 89the DC (and therefore the bitmap) and also to use \helpref{wxDC::Blit}{wxdcblit} to copy
fe604ccd 90the bitmap to a window. For this purpose, you may find \helpref{wxDC::DrawIcon}{wxdcdrawicon}\rtfsp
a660d684
KB
91easier to use instead.
92
fea35690
VZ
93If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is
94selected out of the device context, and the original bitmap restored, allowing the current bitmap to
a660d684
KB
95be destroyed safely.
96
fea35690
VZ
97\wxheading{See also}
98
99\helpref{wxMemoryDC::SelectObject}{wxmemorydcselectobject}
9b50920f 100