1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
<HTML>
<head><title>wxMemoryDC</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxmemorydc"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx136.htm#wxmdiparentframe"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx138.htm#wxmeminputstream"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxMemoryDC</H2>
<P>
A memory device context provides a means to draw graphics onto a bitmap.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx65.htm#wxdc">wxDC</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/dcmemory.h><P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
A bitmap must be selected into the new memory DC before it may be used
for anything. Typical usage is as follows:<P>
<PRE>
// 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);
</PRE>
Note that the memory DC <I>must</I> be deleted (or the bitmap selected out of it) before a bitmap
can be reselected into another memory DC.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx32.htm#wxbitmap">wxBitmap</A>, <A HREF="wx65.htm#wxdc">wxDC</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#topic553">wxMemoryDC::wxMemoryDC</A><BR>
<A HREF="#topic554">wxMemoryDC::SelectObject</A><BR>
<P>
<HR>
<A NAME="topic553"></A>
<H3>wxMemoryDC::wxMemoryDC</H3>
<P>
<B></B> <B>wxMemoryDC</B>()<P>
Constructs a new memory device context.<P>
Use the <I>Ok</I> 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.<P>
<HR>
<A NAME="topic554"></A>
<H3>wxMemoryDC::SelectObject</H3>
<P>
<B></B> <B>SelectObject</B>(<B>const wxBitmap& </B><I>bitmap</I>)<P>
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 <B>Blit</B> to copy
the bitmap to a window. For this purpose, you may find <A HREF="wx65.htm#wxdcdrawicon">wxDC::DrawIcon</A>
easier to use instead.<P>
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.<P>
</BODY></HTML>
|