]> git.saurik.com Git - wxWidgets.git/blob - interface/dcmemory.h
af09579f066bbb37bda98f8a2f526a410b47ea5d
[wxWidgets.git] / interface / dcmemory.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcmemory.h
3 // Purpose: documentation for wxMemoryDC class
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxMemoryDC
11 @wxheader{dcmemory.h}
12
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
15 @c wxWHITE_BRUSH
16 will draw the background colour (i.e. 0) whereas all other colours will draw the
17 foreground colour (i.e. 1).
18
19 @library{wxcore}
20 @category{dc}
21
22 @seealso
23 wxBitmap, wxDC
24 */
25 class wxMemoryDC : public wxDC
26 {
27 public:
28 //@{
29 /**
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.
34 */
35 wxMemoryDC();
36 wxMemoryDC(wxBitmap& bitmap);
37 //@}
38
39 /**
40 Works exactly like SelectObjectAsSource() but
41 this is the function you should use when you select a bitmap because you want
42 to modify
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
46 counted object
47 (see @ref overview_trefcount "reference counting overview").
48 Also, before using the updated bitmap data, make sure to select it out of
49 context first
50 (for example by selecting wxNullBitmap into the device context).
51
52 @see wxDC::DrawBitmap
53 */
54 void SelectObject(wxBitmap& bitmap);
55
56 /**
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
63 current bitmap is
64 selected out of the device context, and the original bitmap restored, allowing
65 the current bitmap to
66 be destroyed safely.
67 */
68 void SelectObjectAsSource(const wxBitmap& bitmap);
69 };