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

Type BufferedDC

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

Known Subclasses:
BufferedPaintDC

This simple class provides a simple way to avoid flicker: when drawing on it, everything is in fact first drawn on an in-memory buffer (a wx.Bitmap) and then copied to the screen only once, when this object is destroyed.

It can be used in the same way as any other device context. wx.BufferedDC itself typically replaces wx.ClientDC, if you want to use it in your EVT_PAINT handler, you should look at wx.BufferedPaintDC.


Method Summary
BufferedDC __init__(self, dc, buffer, style)
__init__(self, DC dc, Size area, int style=BUFFER_CLIENT_AREA) -> BufferedDC
  __del__(self)
Copies everything drawn on the DC so far to the underlying DC associated with this object, if any.
  __repr__(self)
  UnMask(self)
Blits the buffer to the dc, and detaches the dc from the buffer (so it can be effectively used once only).

Method Details

__init__(self, dc, buffer=NullBitmap, style=BUFFER_CLIENT_AREA)
(Constructor)

__init__(self, DC dc, Size area, int style=BUFFER_CLIENT_AREA) -> BufferedDC

Constructs a buffered DC.

Parameters:
dc - The underlying DC: everything drawn to this object will be flushed to this DC when this object is destroyed. You may pass None in order to just initialize the buffer, and not flush it.
           (type=DC)
buffer - If a wx.Size object is passed as the 2nd arg then it is the size of the bitmap that will be created internally and used for an implicit buffer. If the 2nd arg is a wx.Bitmap then it is the explicit buffer that will be used. Using an explicit buffer is the most efficient solution as the bitmap doesn't have to be recreated each time but it also requires more memory as the bitmap is never freed. The bitmap should have appropriate size, anything drawn outside of its bounds is clipped. If wx.NullBitmap is used then a new buffer will be allocated that is the same size as the dc.
           (type=Bitmap)
style - The style parameter indicates whether the supplied buffer is intended to cover the entire virtual size of a wx.ScrolledWindow or if it only covers the client area. Acceptable values are wx.BUFFER_VIRTUAL_AREA and wx.BUFFER_CLIENT_AREA.
           (type=int)
Returns:
BufferedDC
Overrides:
wx.MemoryDC.__init__

__del__(self)
(Destructor)

Copies everything drawn on the DC so far to the underlying DC associated with this object, if any.
Overrides:
wx.DC.__del__

UnMask(self)

Blits the buffer to the dc, and detaches the dc from the buffer (so it can be effectively used once only). This is usually only called in the destructor.

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