X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/41fbc84101e7fc1a3e658f1d3f01664289637f01..180b5b4827d08f1ac13bbb5eca03f775ab35a0b1:/docs/latex/wx/memorydc.tex diff --git a/docs/latex/wx/memorydc.tex b/docs/latex/wx/memorydc.tex index fe12b8ce0c..e71262b954 100644 --- a/docs/latex/wx/memorydc.tex +++ b/docs/latex/wx/memorydc.tex @@ -1,7 +1,8 @@ \section{\class{wxMemoryDC}}\label{wxmemorydc} A memory device context provides a means to draw graphics onto a bitmap. When -drawing in to a mono-bitmap, using {\tt wxWHITE}, {\tt wxWHITE_PEN} and {\tt wxWHITE_BRUSH} +drawing in to a mono-bitmap, using {\tt wxWHITE}, {\tt wxWHITE\_PEN} and +{\tt wxWHITE\_BRUSH} will draw the background colour (i.e. 0) whereas all other colours will draw the foreground colour (i.e. 1). @@ -14,6 +15,10 @@ foreground colour (i.e. 1). +\wxheading{Library} + +\helpref{wxCore}{librarieslist} + \wxheading{Remarks} A bitmap must be selected into the new memory DC before it may be used @@ -32,33 +37,76 @@ for anything. Typical usage is as follows: Note that the memory DC {\it must} be deleted (or the bitmap selected out of it) before a bitmap can be reselected into another memory DC. +And, before performing any other operations on the bitmap data, the bitmap must +be selected out of the memory DC: + +\begin{verbatim} + temp_dc.SelectObject(wxNullBitmap) +\end{verbatim} + +(this happens automatically when wxMemoryDC object goes out of scope). + + \wxheading{See also} \helpref{wxBitmap}{wxbitmap}, \helpref{wxDC}{wxdc} \latexignore{\rtfignore{\wxheading{Members}}} -\membersection{wxMemoryDC::wxMemoryDC} +\membersection{wxMemoryDC::wxMemoryDC}\label{wxmemorydcctor} \func{}{wxMemoryDC}{\void} Constructs a new memory device context. -Use the {\it Ok} member to test whether the constructor was successful -in creating a useable device context. Don't forget to select a bitmap -into the DC before drawing on it. +Use the \helpref{IsOk}{wxdcisok} member to test whether the constructor was successful +in creating a usable device context. +Don't forget to select a bitmap into the DC before drawing on it. + +\func{}{wxMemoryDC}{\param{wxBitmap\& }{bitmap}} + +Constructs a new memory device context and calls \helpref{SelectObject}{wxmemorydcselectobject} +with the given bitmap. +Use the \helpref{IsOk}{wxdcisok} member to test whether the constructor was successful +in creating a usable device context. + + +\membersection{wxMemoryDC::SelectObject}\label{wxmemorydcselectobject} -\membersection{wxMemoryDC::SelectObject} +\func{void}{SelectObject}{\param{wxBitmap\& }{bitmap}} -\func{}{SelectObject}{\param{const wxBitmap\& }{bitmap}} +Works exactly like \helpref{SelectObjectAsSource}{wxmemorydcselectobjectassource} but +this is the function you should use when you select a bitmap because you want to modify +it, e.g. drawing on this DC. + +Using \helpref{SelectObjectAsSource}{wxmemorydcselectobjectassource} when modifying +the bitmap may incurr some problems related to wxBitmap being a reference counted object +(see \helpref{reference counting overview}{trefcount}). + +Also, before using the updated bitmap data, make sure to select it out of context first +(for example by selecting wxNullBitmap into the device context). + +\wxheading{See also} + +\helpref{wxDC::DrawBitmap}{wxdcdrawbitmap} + + + +\membersection{wxMemoryDC::SelectObjectAsSource}\label{wxmemorydcselectobjectassource} + +\func{void}{SelectObjectAsSource}{\param{const wxBitmap\& }{bitmap}} Selects the given bitmap into the device context, to use as the memory bitmap. Selecting the bitmap into a memory DC allows you to draw into -the DC (and therefore the bitmap) and also to use {\bf Blit} to copy +the DC (and therefore the bitmap) and also to use \helpref{wxDC::Blit}{wxdcblit} to copy the bitmap to a window. For this purpose, you may find \helpref{wxDC::DrawIcon}{wxdcdrawicon}\rtfsp easier to use instead. -If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is selected out of the device -context, and the original bitmap restored, allowing the current bitmap to +If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is +selected out of the device context, and the original bitmap restored, allowing the current bitmap to be destroyed safely. +\wxheading{See also} + +\helpref{wxMemoryDC::SelectObject}{wxmemorydcselectobject} +