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, Bitmap buffer=NullBitmap) -> BufferedDC __init__(self, DC dc) -> BufferedDC __init__(self, DC dc, Size area, int style=BUFFER_CLIENT_AREA) -> BufferedDC __init__(self, DC dc, Size 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).
    Inherited from MemoryDC
  SelectObject(self, bitmap)
Selects the bitmap into the device context, to use as the memory bitmap.
    Inherited from DC
  __nonzero__(self)
  BeginDrawing(self)
Allows for optimization of drawing code on platforms that need it.
bool Blit(self, xdest, ydest, width, height, source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask)
Copy from a source DC to this DC.
bool BlitPointSize(self, destPt, sz, source, srcPt, rop, useMask, srcPtMask)
Copy from a source DC to this DC.
  CalcBoundingBox(self, x, y)
Adds the specified point to the bounding box which can be retrieved with MinX, MaxX and MinY, MaxY or GetBoundingBox functions.
  CalcBoundingBoxPoint(self, point)
Adds the specified point to the bounding box which can be retrieved with MinX, MaxX and MinY, MaxY or GetBoundingBox functions.
bool CanDrawBitmap(self)
bool CanGetTextExtent(self)
  Clear(self)
Clears the device context using the current background brush.
  ComputeScaleAndOrigin(self)
Performs all necessary computations for given platform and context type after each change of scale and origin parameters.
  CrossHair(self, x, y)
Displays a cross hair using the current pen.
  CrossHairPoint(self, pt)
Displays a cross hair using the current pen.
  DestroyClippingRegion(self)
Destroys the current clipping region so that none of the DC is clipped.
int DeviceToLogicalX(self, x)
Convert device X coordinate to logical coordinate, using the current mapping mode.
int DeviceToLogicalXRel(self, x)
Convert device X coordinate to relative logical coordinate, using the current mapping mode but ignoring the x axis orientation.
int DeviceToLogicalY(self, y)
Converts device Y coordinate to logical coordinate, using the current mapping mode.
int DeviceToLogicalYRel(self, y)
Convert device Y coordinate to relative logical coordinate, using the current mapping mode but ignoring the y axis orientation.
  DrawArc(self, x1, y1, x2, y2, xc, yc)
Draws an arc of a circle, centred on the center point (xc, yc), from the first point to the second.
  DrawArcPoint(self, pt1, pt2, center)
Draws an arc of a circle, centred on the center point (xc, yc), from the first point to the second.
  DrawBitmap(self, bmp, x, y, useMask)
Draw a bitmap on the device context at the specified point.
  DrawBitmapPoint(self, bmp, pt, useMask)
Draw a bitmap on the device context at the specified point.
  DrawCheckMark(self, x, y, width, height)
Draws a check mark inside the given rectangle.
  DrawCheckMarkRect(self, rect)
Draws a check mark inside the given rectangle.
  DrawCircle(self, x, y, radius)
Draws a circle with the given center point and radius.
  DrawCirclePoint(self, pt, radius)
Draws a circle with the given center point and radius.
  DrawEllipse(self, x, y, width, height)
Draws an ellipse contained in the specified rectangle.
  DrawEllipseList(self, ellipses, pens, brushes)
Draw a list of ellipses as quickly as possible.
  DrawEllipsePointSize(self, pt, sz)
Draws an ellipse contained in the specified rectangle.
  DrawEllipseRect(self, rect)
Draws an ellipse contained in the specified rectangle.
  DrawEllipticArc(self, x, y, w, h, start, end)
Draws an arc of an ellipse, with the given rectangle defining the bounds of the ellipse.
  DrawEllipticArcPointSize(self, pt, sz, start, end)
Draws an arc of an ellipse, with the given rectangle defining the bounds of the ellipse.
  DrawIcon(self, icon, x, y)
Draw an icon on the display (does nothing if the device context is PostScript).
  DrawIconPoint(self, icon, pt)
Draw an icon on the display (does nothing if the device context is PostScript).
Rect DrawImageLabel(self, text, image, rect, alignment, indexAccel)
Draw text and an image (which may be wx.NullBitmap to skip drawing it) within the specified rectangle, abiding by the alignment flags.
  DrawLabel(self, text, rect, alignment, indexAccel)
Draw text within the specified rectangle, abiding by the alignment flags.
  DrawLine(self, x1, y1, x2, y2)
Draws a line from the first point to the second.
  DrawLineList(self, lines, pens)
Draw a list of lines as quickly as possible.
  DrawLinePoint(self, pt1, pt2)
Draws a line from the first point to the second.
  DrawLines(self, points, xoffset, yoffset)
Draws lines using a sequence of wx.Point objects, adding the optional offset coordinate.
  DrawPoint(self, x, y)
Draws a point using the current pen.
  DrawPointList(self, points, pens)
Draw a list of points as quickly as possible.
  DrawPointPoint(self, pt)
Draws a point using the current pen.
  DrawPolygon(self, points, xoffset, yoffset, fillStyle)
Draws a filled polygon using a sequence of wx.Point objects, adding the optional offset coordinate.
  DrawPolygonList(self, polygons, pens, brushes)
Draw a list of polygons, each of which is a list of points.
  DrawRectangle(self, x, y, width, height)
Draws a rectangle with the given top left corner, and with the given size.
  DrawRectangleList(self, rectangles, pens, brushes)
Draw a list of rectangles as quickly as possible.
  DrawRectanglePointSize(self, pt, sz)
Draws a rectangle with the given top left corner, and with the given size.
  DrawRectangleRect(self, rect)
Draws a rectangle with the given top left corner, and with the given size.
  DrawRotatedText(self, text, x, y, angle)
Draws the text rotated by angle degrees, if supported by the platform.
  DrawRotatedTextPoint(self, text, pt, angle)
Draws the text rotated by angle degrees, if supported by the platform.
  DrawRoundedRectangle(self, x, y, width, height, radius)
Draws a rectangle with the given top left corner, and with the given size.
  DrawRoundedRectanglePointSize(self, pt, sz, radius)
Draws a rectangle with the given top left corner, and with the given size.
  DrawRoundedRectangleRect(self, r, radius)
Draws a rectangle with the given top left corner, and with the given size.
  DrawSpline(self, points)
Draws a spline between all given control points, (a list of wx.Point objects) using the current pen.
  DrawText(self, text, x, y)
Draws a text string at the specified point, using the current text font, and the current text foreground and background colours.
  DrawTextList(self, textList, coords, foregrounds, backgrounds)
Draw a list of strings using a list of coordinants for positioning each string.
  DrawTextPoint(self, text, pt)
Draws a text string at the specified point, using the current text font, and the current text foreground and background colours.
  EndDoc(self)
Ends a document (only relevant when outputting to a printer).
  EndDrawing(self)
Ends the group of drawing primitives started with BeginDrawing, and invokes whatever optimization is available for this DC type on the current platform.
  EndPage(self)
Ends a document page (only relevant when outputting to a printer).
bool FloodFill(self, x, y, col, style)
Flood fills the device context starting from the given point, using the current brush colour, and using a style:
bool FloodFillPoint(self, pt, col, style)
Flood fills the device context starting from the given point, using the current brush colour, and using a style:
Brush GetBackground(self)
Gets the brush used for painting the background.
int GetBackgroundMode(self)
Returns the current background mode, either wx.SOLID or wx.TRANSPARENT.
(x1,y1, x2,y2) GetBoundingBox()
Returns the min and max points used in drawing commands so far.
Brush GetBrush(self)
Gets the current brush
int GetCharHeight(self)
Gets the character height of the currently set font.
int GetCharWidth(self)
Gets the average character width of the currently set font.
(x, y, width, height) GetClippingBox()
Gets the rectangle surrounding the current clipping region.
Rect GetClippingRect(self)
Gets the rectangle surrounding the current clipping region.
int GetDepth(self)
Returns the colour depth of the DC.
Point GetDeviceOrigin(self)
(x,y) GetDeviceOriginTuple()
Font GetFont(self)
Gets the current font
(width, height, descent, externalLeading) GetFullTextExtent(string, font)
Get the width, height, decent and leading of the text using the current or specified font.
int GetLogicalFunction(self)
Gets the current logical function (set by SetLogicalFunction).
Point GetLogicalOrigin(self)
(x,y) GetLogicalOriginTuple()
(xScale, yScale) GetLogicalScale()
int GetMapMode(self)
Gets the current mapping mode for the device context
(width, height, descent, externalLeading) GetMultiLineTextExtent(string, font)
Get the width, height, decent and leading of the text using the current or specified font.
  GetOptimization(*args, **kwargs)
<function GetOptimization at 0xb7b543e4> is deprecated
[widths] GetPartialTextExtents(self, text)
Returns a list of integers such that each value is the distance in pixels from the begining of text to the coresponding character of text.
Pen GetPen(self)
Gets the current pen
Colour GetPixel(self, x, y)
Gets the colour at the specified location on the DC.
Colour GetPixelPoint(self, pt)
Size GetPPI(self)
Resolution in Pixels per inch
Size GetSize(self)
This gets the horizontal and vertical resolution in device units.
Size GetSizeMM(self)
Get the DC size in milimeters.
(width, height) GetSizeMMTuple()
Get the DC size in milimeters.
(width, height) GetSizeTuple()
This gets the horizontal and vertical resolution in device units.
Colour GetTextBackground(self)
Gets the current text background colour
(width, height) GetTextExtent(string)
Get the width and height of the text using the current font.
Colour GetTextForeground(self)
Gets the current text foreground colour
(xScale, yScale) GetUserScale(self)
Gets the current user scale factor (set by SetUserScale).
int LogicalToDeviceX(self, x)
Converts logical X coordinate to device coordinate, using the current mapping mode.
int LogicalToDeviceXRel(self, x)
Converts logical X coordinate to relative device coordinate, using the current mapping mode but ignoring the x axis orientation.
int LogicalToDeviceY(self, y)
Converts logical Y coordinate to device coordinate, using the current mapping mode.
int LogicalToDeviceYRel(self, y)
Converts logical Y coordinate to relative device coordinate, using the current mapping mode but ignoring the y axis orientation.
int MaxX(self)
Gets the maximum horizontal extent used in drawing commands so far.
int MaxY(self)
Gets the maximum vertical extent used in drawing commands so far.
int MinX(self)
Gets the minimum horizontal extent used in drawing commands so far.
int MinY(self)
Gets the minimum vertical extent used in drawing commands so far.
bool Ok(self)
Returns true if the DC is ok to use.
  ResetBoundingBox(self)
Resets the bounding box: after a call to this function, the bounding box doesn't contain anything.
  SetAxisOrientation(self, xLeftRight, yBottomUp)
Sets the x and y axis orientation (i.e., the direction from lowest to highest values on the axis).
  SetBackground(self, brush)
Sets the current background brush for the DC.
  SetBackgroundMode(self, mode)
mode may be one of wx.SOLID and wx.TRANSPARENT.
  SetBrush(self, brush)
Sets the current brush for the DC.
  SetClippingRect(self, rect)
Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region.
  SetClippingRegion(self, x, y, width, height)
Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region.
  SetClippingRegionAsRegion(self, region)
Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region.
  SetClippingRegionPointSize(self, pt, sz)
Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region.
  SetDeviceOrigin(self, x, y)
  SetDeviceOriginPoint(self, point)
  SetFont(self, font)
Sets the current font for the DC.
  SetLogicalFunction(self, function)
Sets the current logical function for the device context.
  SetLogicalOrigin(self, x, y)
  SetLogicalOriginPoint(self, point)
  SetLogicalScale(self, x, y)
  SetMapMode(self, mode)
The mapping mode of the device context defines the unit of measurement used to convert logical units to device units.
  SetOptimization(*args, **kwargs)
<function SetOptimization at 0xb7b543ac> is deprecated
  SetPalette(self, palette)
If this is a window DC or memory DC, assigns the given palette to the window or bitmap associated with the DC.
  SetPen(self, pen)
Sets the current pen for the DC.
  SetTextBackground(self, colour)
Sets the current text background colour for the DC.
  SetTextForeground(self, colour)
Sets the current text foreground colour for the DC.
  SetUserScale(self, x, y)
Sets the user scaling factor, useful for applications which require 'zooming'.
bool StartDoc(self, message)
Starts a document (only relevant when outputting to a printer).
  StartPage(self)
Starts a document page (only relevant when outputting to a printer).
    Inherited from Object
  Destroy(self)
Deletes the C++ object this Python object is a proxy for.
String GetClassName(self)
Returns the class name of the C++ class using wxRTTI.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Method Details

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

__init__(self, DC dc, Bitmap buffer=NullBitmap) -> BufferedDC __init__(self, DC dc) -> BufferedDC __init__(self, DC dc, Size area, int style=BUFFER_CLIENT_AREA) -> BufferedDC __init__(self, DC dc, Size 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.20050511.rpd on Sat Jun 16 16:45:52 2007 http://epydoc.sf.net