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

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Wed Mar 11 00:33:36 PDT 2015


On Wed, 11 Mar 2015 07:13:48 +0100, Olaf Schmidt wrote:

> But since you insist - here you can look at the entire
> VB6-Form-Code...
> http://vbRichClient.com/Downloads/AlhambraTiles_FormCode.txt

I see a number of limitations. You hard code the size of the pattern,
rather than deriving it from the size of the design elements. Then I
see things like

  For j = 0 To 3: For i = 0 To 3 + j

So you have to make 22 separate copies of the pattern in order to
ensure there are no gaps. A bit excessive, don’t you think?

> And I wasn't trying "to show up deficiencies in Python" (generally) -
> just pointing out inefficient (overcomplicated, if you like that
> better) coding of your Tile-Pattern-generator-routines.

> Anyways, the facts are, that the VB6-Code in the link above:
> - has about factor 2.5 less lines of code than your Python-based
>    Alhambra-Routines at:
>    https://github.com/ldo/qahirah_examples/blob/master/alhambra_tiles
> - is able to produce all kind of variations of the two patterns as
> well

My code is more general than yours.

> - is more near the cairo-base-API (and thus nearly 1:1 portable to C)

Which is something I thought I made clear I was trying to get away from.

> The last point above I've made, since your latest Alhambra-Tiles-
> Revision is producing artefacts with certain angle-arguments...
> Here's the PNG-output, your revised Python-code produced:
> http://vbRichClient.com/Downloads/alhambra_tiles2.py.png
> ...please have a look at the two last images in the Top-Row.

I think you are looking at a version which is already several hours old.
I was able to do complete coverage of the triwing tiling with just 7
copies of the pattern. Unlike your version.

> What I've also noticed (I'm mentioning it only, since you didn't
> label your wrapper as "experimental") ... it broke existing code -
> meaning, that your older alhambra.py-example doesn't work with
> your latest quahira.py anymore

You *did* see this in the README, did you not:

	**WARNING:** This Python binding is still to be considered in a
	state of flux for now, subject to whatever reorganization looks
	to be necessary as experience is gained with using it.


More information about the cairo mailing list