]>
git.saurik.com Git - wxWidgets.git/blob - interface/dcmemory.h
af09579f066bbb37bda98f8a2f526a410b47ea5d
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxMemoryDC class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 A memory device context provides a means to draw graphics onto a bitmap. When
14 drawing in to a mono-bitmap, using @c wxWHITE, @c wxWHITE_PEN and
16 will draw the background colour (i.e. 0) whereas all other colours will draw the
17 foreground colour (i.e. 1).
25 class wxMemoryDC
: public wxDC
30 Constructs a new memory device context and calls SelectObject()
31 with the given bitmap.
32 Use the wxDC::IsOk member to test whether the constructor was successful
33 in creating a usable device context.
36 wxMemoryDC(wxBitmap
& bitmap
);
40 Works exactly like SelectObjectAsSource() but
41 this is the function you should use when you select a bitmap because you want
43 it, e.g. drawing on this DC.
44 Using SelectObjectAsSource() when modifying
45 the bitmap may incurr some problems related to wxBitmap being a reference
47 (see @ref overview_trefcount "reference counting overview").
48 Also, before using the updated bitmap data, make sure to select it out of
50 (for example by selecting wxNullBitmap into the device context).
54 void SelectObject(wxBitmap
& bitmap
);
57 Selects the given bitmap into the device context, to use as the memory
58 bitmap. Selecting the bitmap into a memory DC allows you to draw into
59 the DC (and therefore the bitmap) and also to use wxDC::Blit to copy
60 the bitmap to a window. For this purpose, you may find wxDC::DrawIcon
61 easier to use instead.
62 If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the
64 selected out of the device context, and the original bitmap restored, allowing
68 void SelectObjectAsSource(const wxBitmap
& bitmap
);