]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/memorydc.tex
Added rotation to wxImage
[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. When
4 drawing in to a mono-bitmap, using {\tt wxWHITE}, {\tt wxWHITE_PEN} and {\tt wxWHITE_BRUSH}
5 will draw the background colour (i.e. 0) whereas all other colours will draw the
6 foreground colour (i.e. 1).
7
8 \wxheading{Derived from}
9
10 \helpref{wxDC}{wxdc}\\
11 \helpref{wxObject}{wxobject}
12
13 \wxheading{Include files}
14
15 <wx/dcmemory.h>
16
17 \wxheading{Remarks}
18
19 A bitmap must be selected into the new memory DC before it may be used
20 for 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
32 Note that the memory DC {\it must} be deleted (or the bitmap selected out of it) before a bitmap
33 can 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
45 Constructs a new memory device context.
46
47 Use the {\it Ok} member to test whether the constructor was successful
48 in creating a useable device context. Don't forget to select a bitmap
49 into the DC before drawing on it.
50
51 \membersection{wxMemoryDC::SelectObject}
52
53 \func{}{SelectObject}{\param{const wxBitmap\& }{bitmap}}
54
55 Selects the given bitmap into the device context, to use as the memory
56 bitmap. Selecting the bitmap into a memory DC allows you to draw into
57 the DC (and therefore the bitmap) and also to use {\bf Blit} to copy
58 the bitmap to a window. For this purpose, you may find \helpref{wxDC::DrawIcon}{wxdcdrawicon}\rtfsp
59 easier to use instead.
60
61 If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is selected out of the device
62 context, and the original bitmap restored, allowing the current bitmap to
63 be destroyed safely.
64