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.
+ is destroyed. You can either provide a buffer bitmap yourself, and
+ reuse it the next time something needs painted, or you can let the
+ buffered DC create and provide a buffer bitmap itself.
- It can be used in the same way as any other device context.
+ Buffered DCs 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`.
+ `wx.BufferedPaintDC`. You can also use a wx.BufferedDC without
+ providing a target DC. In this case the operations done on the dc
+ will only be written to the buffer bitmap and *not* to any window, so
+ you will want to have provided the buffer bitmap and then reuse it
+ when it needs painted to the window.
Please note that GTK+ 2.0 and OS X provide double buffering themselves
- natively. wxBufferedDC is aware of this however, and will bypass the buffering
- unless an explicit buffer bitmap is given.
+ natively. You may want to use `wx.Window.IsDoubleBuffered` to
+ determine whether you need to use buffering or not, or use
+ `wx.AutoBufferedPaintDC` to avoid needless double buffering on systems
+ that already do it automatically.
+
+
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
__swig_destroy__ = _gdi_.delete_GraphicsContext
__del__ = lambda self : None;
- def Create(*args, **kwargs):
- """Create(WindowDC dc) -> GraphicsContext"""
- val = _gdi_.GraphicsContext_Create(*args, **kwargs)
- val.__dc = args[0] # save a ref so the other dc will not be deleted before self
+ def Create(*args):
+ """
+ Create(WindowDC dc) -> GraphicsContext
+ Create(Window window) -> GraphicsContext
+ """
+ val = _gdi_.GraphicsContext_Create(*args)
+ val.__dc = args[0] # save a ref so the dc will not be deleted before self
return val
Create = staticmethod(Create)
+ def CreateFromNative(*args, **kwargs):
+ """CreateFromNative(void context) -> GraphicsContext"""
+ return _gdi_.GraphicsContext_CreateFromNative(*args, **kwargs)
+
+ CreateFromNative = staticmethod(CreateFromNative)
def CreatePath(*args, **kwargs):
"""CreatePath(self) -> GraphicsPath"""
return _gdi_.GraphicsContext_CreatePath(*args, **kwargs)
"""PopState(self)"""
return _gdi_.GraphicsContext_PopState(*args, **kwargs)
+ def ClipRegion(*args, **kwargs):
+ """ClipRegion(self, Region region)"""
+ return _gdi_.GraphicsContext_ClipRegion(*args, **kwargs)
+
def Clip(*args, **kwargs):
- """Clip(self, Region region)"""
+ """Clip(self, Double x, Double y, Double w, Double h)"""
return _gdi_.GraphicsContext_Clip(*args, **kwargs)
+ def ResetClip(*args, **kwargs):
+ """ResetClip(self)"""
+ return _gdi_.GraphicsContext_ResetClip(*args, **kwargs)
+
+ def GetNativeContext(*args, **kwargs):
+ """GetNativeContext(self) -> void"""
+ return _gdi_.GraphicsContext_GetNativeContext(*args, **kwargs)
+
def Translate(*args, **kwargs):
"""Translate(self, Double dx, Double dy)"""
return _gdi_.GraphicsContext_Translate(*args, **kwargs)
def SetRadialGradientBrush(*args, **kwargs):
"""
SetRadialGradientBrush(self, Double xo, Double yo, Double xc, Double yc, Double radius,
- Colour oColor, Colour cColor)
+ Colour oColour, Colour cColour)
"""
return _gdi_.GraphicsContext_SetRadialGradientBrush(*args, **kwargs)
"""SetFont(self, Font font)"""
return _gdi_.GraphicsContext_SetFont(*args, **kwargs)
- def SetTextColor(*args, **kwargs):
- """SetTextColor(self, Colour col)"""
- return _gdi_.GraphicsContext_SetTextColor(*args, **kwargs)
+ def SetTextColour(*args, **kwargs):
+ """SetTextColour(self, Colour col)"""
+ return _gdi_.GraphicsContext_SetTextColour(*args, **kwargs)
def StrokePath(*args, **kwargs):
"""StrokePath(self, GraphicsPath path)"""
"""DrawRotatedText(self, String str, Double x, Double y, Double angle)"""
return _gdi_.GraphicsContext_DrawRotatedText(*args, **kwargs)
+ def GetFullTextExtent(*args, **kwargs):
+ """GetFullTextExtent(self, text) --> (width, height, descent, externalLeading)"""
+ return _gdi_.GraphicsContext_GetFullTextExtent(*args, **kwargs)
+
def GetTextExtent(*args, **kwargs):
- """GetTextExtend(self, text) --> (width, height, descent, externalLeading)"""
+ """GetTextExtent(self, text) --> (width, height)"""
return _gdi_.GraphicsContext_GetTextExtent(*args, **kwargs)
def GetPartialTextExtents(*args, **kwargs):
_gdi_.GraphicsContext_swigregister(GraphicsContext)
-def GraphicsContext_Create(*args, **kwargs):
- """GraphicsContext_Create(WindowDC dc) -> GraphicsContext"""
- val = _gdi_.GraphicsContext_Create(*args, **kwargs)
- val.__dc = args[0] # save a ref so the other dc will not be deleted before self
+def GraphicsContext_Create(*args):
+ """
+ Create(WindowDC dc) -> GraphicsContext
+ GraphicsContext_Create(Window window) -> GraphicsContext
+ """
+ val = _gdi_.GraphicsContext_Create(*args)
+ val.__dc = args[0] # save a ref so the dc will not be deleted before self
return val
+def GraphicsContext_CreateFromNative(*args, **kwargs):
+ """GraphicsContext_CreateFromNative(void context) -> GraphicsContext"""
+ return _gdi_.GraphicsContext_CreateFromNative(*args, **kwargs)
+
class GCDC(DC):
"""Proxy of C++ GCDC class"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__swig_destroy__ = _gdi_.delete_GCDC
__del__ = lambda self : None;
- def GetGraphicContext(*args, **kwargs):
- """GetGraphicContext(self) -> GraphicsContext"""
- return _gdi_.GCDC_GetGraphicContext(*args, **kwargs)
+ def GetGraphicsContext(*args, **kwargs):
+ """GetGraphicsContext(self) -> GraphicsContext"""
+ return _gdi_.GCDC_GetGraphicsContext(*args, **kwargs)
+
+ def SetGraphicsContext(*args, **kwargs):
+ """SetGraphicsContext(self, GraphicsContext ctx)"""
+ return _gdi_.GCDC_SetGraphicsContext(*args, **kwargs)
+ GraphicsContext = property(GetGraphicsContext,SetGraphicsContext)
_gdi_.GCDC_swigregister(GCDC)
class Overlay(object):