Package wx :: Class MemoryDC
[frames | no frames]

Type MemoryDC

object --+        
         |        
    Object --+    
             |    
            DC --+
                 |
                MemoryDC

Known Subclasses:
BitmapBuffer, BufferedDC

A memory device context provides a means to draw graphics onto a bitmap. A bitmap must be selected into the new memory DC before it may be used for anything. Typical usage is as follows:

dc = wx.MemoryDC()
dc.SelectObject(bitmap)
# draw on the dc usign any of the Draw methods
dc.SelectObject(wx.NullBitmap)
# the bitmap now contains wahtever was drawn upon it

Note that the memory DC must be deleted (or the bitmap selected out of it) before a bitmap can be reselected into another memory DC.


Method Summary
MemoryDC __init__(self)
Constructs a new memory device context.
  __repr__(self)
  SelectObject(self, bitmap)
Selects the bitmap into the device context, to use as the memory bitmap.

Method Details

__init__(self)
(Constructor)

Constructs a new memory device context.

Use the Ok 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.

Returns:
MemoryDC
Overrides:
wx.DC.__init__

See Also: MemoryDCFromDC

SelectObject(self, bitmap)

Selects the 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.

If the argument is wx.NullBitmap (or some other uninitialised wx.Bitmap) the current bitmap is selected out of the device context, and the original bitmap restored, allowing the current bitmap to be destroyed safely.

Parameters:
bitmap
           (type=Bitmap)

Generated by Epydoc 2.1.20040428.rpd on Tue Apr 26 14:24:02 2005 http://epydoc.sf.net