| 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{Remarks} |
| 11 | |
| 12 | A bitmap must be selected into the new memory DC before it may be used |
| 13 | for 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 | |
| 25 | Note that the memory DC {\it must} be deleted (or the bitmap selected out of it) before a bitmap |
| 26 | can 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 | |
| 38 | Constructs a new memory device context. |
| 39 | |
| 40 | Use the {\it Ok} member to test whether the constructor was successful |
| 41 | in creating a useable device context. Don't forget to select a bitmap |
| 42 | into the DC before drawing on it. |
| 43 | |
| 44 | \membersection{wxMemoryDC::SelectObject} |
| 45 | |
| 46 | \func{}{SelectObject}{\param{const wxBitmap\& }{bitmap}} |
| 47 | |
| 48 | Selects the given bitmap into the device context, to use as the memory |
| 49 | bitmap. Selecting the bitmap into a memory DC allows you to draw into |
| 50 | the DC (and therefore the bitmap) and also to use {\bf Blit} to copy |
| 51 | the bitmap to a window. For this purpose, you may find \helpref{wxDC::DrawIcon}{wxdcdrawicon}\rtfsp |
| 52 | easier to use instead. |
| 53 | |
| 54 | If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is selected out of the device |
| 55 | context, and the original bitmap restored, allowing the current bitmap to |
| 56 | be destroyed safely. |
| 57 | |