1 \section{\class{wxMemoryDC
}}\label{wxmemorydc
}
3 A memory device context provides a means to draw graphics onto a bitmap. When
4 drawing in to a mono-bitmap, using
{\tt wxWHITE
},
{\tt wxWHITE
\_PEN} and
6 will draw the background colour (i.e.
0) whereas all other colours will draw the
7 foreground colour (i.e.
1).
9 \wxheading{Derived from
}
11 \helpref{wxDC
}{wxdc
}\\
12 \helpref{wxObject
}{wxobject
}
14 \wxheading{Include files
}
20 \helpref{wxCore
}{librarieslist
}
24 A bitmap must be selected into the new memory DC before it may be used
25 for anything. Typical usage is as follows:
30 temp_dc.SelectObject(test_bitmap);
32 // We can now draw into the memory DC...
33 // Copy from this DC to another DC.
34 old_dc.Blit(
250,
50, BITMAP_WIDTH, BITMAP_HEIGHT, temp_dc,
0,
0);
37 Note that the memory DC
{\it must
} be deleted (or the bitmap selected out of it) before a bitmap
38 can be reselected into another memory DC.
42 \helpref{wxBitmap
}{wxbitmap
},
\helpref{wxDC
}{wxdc
}
44 \latexignore{\rtfignore{\wxheading{Members
}}}
46 \membersection{wxMemoryDC::wxMemoryDC
}\label{wxmemorydcctor
}
48 \func{}{wxMemoryDC
}{\void}
50 Constructs a new memory device context.
52 Use the
\helpref{IsOk
}{wxdcisok
} member to test whether the constructor was successful
53 in creating a usable device context.
54 Don't forget to select a bitmap into the DC before drawing on it.
56 \func{}{wxMemoryDC
}{\param{wxBitmap\&
}{bitmap
}}
58 Constructs a new memory device context and calls
\helpref{SelectObject
}{wxmemorydcselectobject
}
59 with the given bitmap.
60 Use the
\helpref{IsOk
}{wxdcisok
} member to test whether the constructor was successful
61 in creating a usable device context.
64 \membersection{wxMemoryDC::SelectObject
}\label{wxmemorydcselectobject
}
66 \func{void
}{SelectObject
}{\param{wxBitmap\&
}{bitmap
}}
68 Works exactly like
\helpref{SelectObjectAsSource
}{wxmemorydcselectobjectassource
} but
69 this is the function you should use when you select a bitmap because you want to modify
70 it, e.g. drawing on this DC.
72 Be careful to use this function and not
\helpref{SelectObjectAsSource
}{wxmemorydcselectobjectassource
}
73 when you want to modify the bitmap you are selecting otherwise you may incurr in some
74 problems related to wxBitmap being a reference counted object
75 (see
\helpref{reference counting overview
}{trefcount
}).
79 \helpref{wxDC::DrawBitmap
}{wxdcdrawbitmap
}
83 \membersection{wxMemoryDC::SelectObjectAsSource
}\label{wxmemorydcselectobjectassource
}
85 \func{void
}{SelectObjectAsSource
}{\param{const wxBitmap\&
}{bitmap
}}
87 Selects the given bitmap into the device context, to use as the memory
88 bitmap. Selecting the bitmap into a memory DC allows you to draw into
89 the DC (and therefore the bitmap) and also to use
\helpref{wxDC::Blit
}{wxdcblit
} to copy
90 the bitmap to a window. For this purpose, you may find
\helpref{wxDC::DrawIcon
}{wxdcdrawicon
}\rtfsp
91 easier to use instead.
93 If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is
94 selected out of the device context, and the original bitmap restored, allowing the current bitmap to
99 \helpref{wxMemoryDC::SelectObject
}{wxmemorydcselectobject
}