wxWidgets/docs/latex/wx/memorydc.tex
Harco de Hilster d17f05afeb Some fixes (&->\&, _->\_) to remove latex complaints.
Actually the whole point of this excercise was to try to make a nice pdf file
with contents tree and thumbnail pages using pdflatex, but it keeps depleting
tex's resources :-(


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5884 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2000-02-07 10:14:56 +00:00

66 lines
2.0 KiB
TeX

\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}
will draw the background colour (i.e. 0) whereas all other colours will draw the
foreground colour (i.e. 1).
\wxheading{Derived from}
\helpref{wxDC}{wxdc}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/dcmemory.h>
\wxheading{Remarks}
A bitmap must be selected into the new memory DC before it may be used
for anything. Typical usage is as follows:
\begin{verbatim}
// Create a memory DC
wxMemoryDC temp_dc;
temp_dc.SelectObject(test_bitmap);
// We can now draw into the memory DC...
// Copy from this DC to another DC.
old_dc.Blit(250, 50, BITMAP_WIDTH, BITMAP_HEIGHT, temp_dc, 0, 0);
\end{verbatim}
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.
\wxheading{See also}
\helpref{wxBitmap}{wxbitmap}, \helpref{wxDC}{wxdc}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxMemoryDC::wxMemoryDC}
\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.
\membersection{wxMemoryDC::SelectObject}
\func{}{SelectObject}{\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 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
be destroyed safely.