Package aldrin :: Module canvas :: Class CanvasBase
[show private | hide private]
[frames | no frames]

Class CanvasBase

Known Subclasses:
Canvas, ScrolledCanvas

A canvas class for arbitrary drawing.

The Canvas class implements a window that allows for drawing arbitrary graphics. It implements a double buffer scheme and blits the off-screen buffer to the window during paint calls by the windowing system for speed.

Some other methods for determining the canvas colour and size are also provided.
Method Summary
  __init__(self, *args, **kargs)
Creates a canvas instance and initializes the off-screen buffer.
  _finalize_canvas_init(self)
  Blit(self, dc)
Performs the blit of the buffer contents on-screen.
  DrawBuffer(self, *args, **kargs)
Actual drawing function for drawing into the off-screen buffer.
  GetBoundingRect(self)
Returns a tuple that contains the co-ordinates of the top-left and bottom-right corners of the canvas.
  MakeNewBuffer(self)
  onEraseBackground(self, event)
  onPaint(self, event)
Renders the off-screen buffer on-screen.
  onPostPaint(self, dc)
  onSize(self, event)
Perform actual redraw to off-screen buffer only when the size of the canvas has changed.
  ReDraw(self, *args, **kargs)
Explicitly tells the canvas to redraw it's contents.
  Refresh(self)

Class Variable Summary
bool doublebuffered = True

Method Details

__init__(self, *args, **kargs)
(Constructor)

Creates a canvas instance and initializes the off-screen buffer. Also sets the handler for rendering the canvas automatically via size and paint calls from the windowing system.

Blit(self, dc)

Performs the blit of the buffer contents on-screen.

DrawBuffer(self, *args, **kargs)

Actual drawing function for drawing into the off-screen buffer. To be overrideen in the implementing class. Do nothing by default.

GetBoundingRect(self)

Returns a tuple that contains the co-ordinates of the top-left and bottom-right corners of the canvas.

onPaint(self, event)

Renders the off-screen buffer on-screen.

onSize(self, event)

Perform actual redraw to off-screen buffer only when the size of the canvas has changed. This saves a lot of computation since the same image can be re-used, provided the canvas size hasn't changed.

ReDraw(self, *args, **kargs)

Explicitly tells the canvas to redraw it's contents.

Class Variable Details

doublebuffered

Type:
bool
Value:
True                                                                   

Generated by Epydoc 2.1 on Sun Feb 4 18:01:14 2007 http://epydoc.sf.net