Phoenix Logo


This module implements an API similar to wx.GraphicsContext and its related classes. In this case the implementation for all platforms is done using Cairo, via the wx.lib.wxcairo glue module.

Why do this? Why not just use wx.GraphicsContext everywhere? Using Cairo on every platform enables us to more easily be totally consistent on all platforms. Implementing it in Python means that it is easy to fill in the gaps in functionality with features of Cairo that wx.GraphicsContext may not provide, like converting text to a path, using compositing operators, or being able to provide an implementation for things like context.Clear().

Why not just use Cairo directly? There may be times when you do want to use wx.GrpahicsContext, so being able to share code between that and this implementation is nice. Also, I like the class hierarchy and API exposed by the wx.GraphicsContext classes a little better than Cairo’s.


It is possible to write code using this module that is not compatible with wx.GraphicsContext code, because, you know, this is Python and it is lots more flexible and powerful. However the intent is that the reverse will not be true, that code compatible with wx.GraphicsContext will (mostly) work when using these classes instead. Care should be taken when modifying this module so that the compatibility is maintained.

function_summary Functions Summary


class_summary Classes Summary

_OffsetHelper A helper used by the context class.
GraphicsBitmap A GraphicsBitmap is a wrapper around a cairo ImageSurface. It can
GraphicsBrush A GraphicsBrush is used to define how fills are painted.
GraphicsContext The GraphicsContext is the object which facilitates drawing to a surface.
GraphicsFont A GraphicsFont is an adapter to allow using wx.Font with a
GraphicsGradientStop This class represents a single color-stop in a gradient brush. The
GraphicsGradientStops An ordered collection of gradient color stops
GraphicsMatrix A matrix holds an affine transformations, such as a scale,
GraphicsObject Base class for the other Graphics* classes.
GraphicsPath A GraphicsPath is a representation of a geometric path, essentially
GraphicsPen A GraphicsPen is used to define the properties of how a stroke is drawn.