h1(#wxmemorydc). Wx::MemoryDC
A memory device context provides a means to draw graphics onto a
bitmap. When drawing in to a mono-bitmap, using @WHITE@, @WHITE_PEN@ and
@WHITE_BRUSH@ will draw the background colour (i.e. 0) whereas all other
colours will draw the foreground colour (i.e. 1).
h2. Derived from
"DC":dc.html
"Object":object.html
h2. Remarks
A bitmap must be selected into the new memory DC before it may be used
for anything. Using the "Bitmap#draw":Bitmap.html#Bitmap_draw method
with a block ensures that the DC is properly set up and disposed of, and
it's recommended you use that method to create a MemoryDC rather than
instantiating it directly.
h2. See also
"Bitmap":bitmap.html, "DC":dc.html
h2. Methods
* "MemoryDC.new":#MemoryDC_new
* "MemoryDC#select_object":#MemoryDC_selectobject
h3(#MemoryDC_new). MemoryDC.new
h3(#MemoryDC_selectobject). MemoryDC#select_object
*select_object*(%(arg-type)"Bitmap":bitmap.html% 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 *Blit* to copy the
bitmap to a window. For simple drawing of Bitmaps onto a window's DC,
you may find "DC#draw_icon":dc.html#DC_drawicon easier to use instead.
If the argument is Wx::NULL_BITMAP (or some other uninitialised Bitmap) the
current bitmap is selected out of the device context, and the original
bitmap restored, allowing the current bitmap to be destroyed safely.
It is recommended that you use "Bitmap#draw":Bitmap.html#Bitmap_draw
rather than creating a MemoryDC and calling select_object yourself.