]>
git.saurik.com Git - wxWidgets.git/blob - interface/dcmemory.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxMemoryDC
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).
24 class wxMemoryDC
: public wxDC
29 Constructs a new memory device context and calls SelectObject()
30 with the given bitmap.
31 Use the wxDC::IsOk member to test whether the constructor was successful
32 in creating a usable device context.
35 wxMemoryDC(wxBitmap
& bitmap
);
39 Works exactly like SelectObjectAsSource() but
40 this is the function you should use when you select a bitmap because you want
42 it, e.g. drawing on this DC.
43 Using SelectObjectAsSource() when modifying
44 the bitmap may incurr some problems related to wxBitmap being a reference
46 (see @ref overview_trefcount "reference counting overview").
47 Also, before using the updated bitmap data, make sure to select it out of
49 (for example by selecting wxNullBitmap into the device context).
53 void SelectObject(wxBitmap
& bitmap
);
56 Selects the given bitmap into the device context, to use as the memory
57 bitmap. Selecting the bitmap into a memory DC allows you to draw into
58 the DC (and therefore the bitmap) and also to use wxDC::Blit to copy
59 the bitmap to a window. For this purpose, you may find wxDC::DrawIcon
60 easier to use instead.
61 If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the
63 selected out of the device context, and the original bitmap restored, allowing
67 void SelectObjectAsSource(const wxBitmap
& bitmap
);