]>
git.saurik.com Git - wxWidgets.git/blob - interface/dcmemory.h
de07c92384a08e0eda58e82c2d92e478ab9c094f
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.
45 Using SelectObjectAsSource() when modifying
46 the bitmap may incurr some problems related to wxBitmap being a reference
48 (see @ref overview_trefcount "reference counting overview").
50 Also, before using the updated bitmap data, make sure to select it out of
52 (for example by selecting wxNullBitmap into the device context).
56 void SelectObject(wxBitmap
& bitmap
);
59 Selects the given bitmap into the device context, to use as the memory
60 bitmap. Selecting the bitmap into a memory DC allows you to draw into
61 the DC (and therefore the bitmap) and also to use wxDC::Blit to copy
62 the bitmap to a window. For this purpose, you may find wxDC::DrawIcon
63 easier to use instead.
65 If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the
67 selected out of the device context, and the original bitmap restored, allowing
71 void SelectObjectAsSource(const wxBitmap
& bitmap
);