[cairo] Qahirah: A High-Level Cairo API Binding For Python 3

Bill Spitzak spitzak at gmail.com
Fri Mar 6 15:49:36 PST 2015


This looks really nice.

Is it generated automatically or did you write all this by hand?

Is there a reason you always have create() methods rather than making 
the object constructor take the arguments?

Do you know if it will work with Python < 3?

On 03/06/2015 03:09 PM, Lawrence D'Oliveiro wrote:
> It seems like Pycairo <http://cairographics.org/pycairo/> has not had
> much TLC in over two years. Besides its incompleteness, it suffers
> inherent limitations from being written in C, which would not afflict a
> Python binding written in Python.
>
> So here is Qahirah <https://github.com/ldo/qahirah>, yet another Python
> binding for Cairo, this one concentrating specifically on Python 3.
> Being done in Python, I can go beyond the language limitations of C,
> which constrain Cairo itself. Thus, instead of doing separate
> calculations on x and y coordinates, I provide a Vector type, allowing
> you to do arithmetic along both coordinate axes in a single expression.
>
> Similarly, instead of always having to specify colours with separate R,
> G, B and A components, I define a Colour class, which allows you to
> work with colours freely in your choice of RGBA, HSVA, HLSA and YIQA
> spaces, courtesy of the standard Python colorsys module. Of course, all
> colours are automatically converted to RGBA form before being passed to
> Cairo.
>
> Other places where Qahirah offers capabilities going beyond Cairo
> itself are the Path and Matrix types. I also allow method-chaining for
> drawing calls.
>
> In terms of direct support for Cairo functionality, I would say it is
> already roughly at feature parity with Pycairo. Cairo features I have
> implemented that are not in Pycairo include access to FreeType fonts
> and mesh patterns. The main omissions from Qahirah at this point are
> regions and the GUI surface types.
>
> Some example scripts are here <https://github.com/ldo/qahirah_examples>.
>


More information about the cairo mailing list