wxRuby Documentation Home

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).

Derived from

DC

Object

Remarks

A bitmap must be selected into the new memory DC before it may be used
for anything. Using the 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.

See also

Bitmap, DC

Methods

MemoryDC.new

MemoryDC#select_object

select_object(%(arg-type)Bitmap% 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 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
rather than creating a MemoryDC and calling select_object yourself.

[This page automatically generated from the Textile source at 2023-06-09 00:45:26 +0000]