]> git.saurik.com Git - wxWidgets.git/blob - interface/dcmemory.h
rename fobr95.{cpp,h} files to foobar.{cpp,h}
[wxWidgets.git] / interface / dcmemory.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcmemory.h
3 // Purpose: interface of wxMemoryDC
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 @see wxBitmap, wxDC
23 */
24 class wxMemoryDC : public wxDC
25 {
26 public:
27 //@{
28 /**
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.
33 */
34 wxMemoryDC();
35 wxMemoryDC(wxBitmap& bitmap);
36 //@}
37
38 /**
39 Works exactly like SelectObjectAsSource() but
40 this is the function you should use when you select a bitmap because you want
41 to modify
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
45 counted object
46 (see @ref overview_trefcount "reference counting overview").
47 Also, before using the updated bitmap data, make sure to select it out of
48 context first
49 (for example by selecting wxNullBitmap into the device context).
50
51 @see wxDC::DrawBitmap
52 */
53 void SelectObject(wxBitmap& bitmap);
54
55 /**
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
62 current bitmap is
63 selected out of the device context, and the original bitmap restored, allowing
64 the current bitmap to
65 be destroyed safely.
66 */
67 void SelectObjectAsSource(const wxBitmap& bitmap);
68 };
69