Re: Qahirah: A High-Level Cairo API Binding For Python 3
Dan Raymond <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
On 3/6/2015 6:53 PM, Lawrence D'Oliveiro wrote: > On Fri, 06 Mar 2015 18:34:51 -0700, Dan Raymond wrote: > >>> Being done in Python, I can go beyond the language limitations of C, >>> which constrain Cairo itself. >> Huh? Higher level languages like Python are always more limiting >> than C. > From > <https://github.com/ldo/qahirah_examples/blob/master/alhambra_tiles>: > > # construct triwing pattern > curve_factor = .7 > tilt = 30 / deg > c0 = Matrix.rotate(30 / deg).map(Vector(1, 0)) > c3 = Matrix.rotate(- 120 / deg).map(c0) > c1 = c0 + (c3 - c0).rotate(tilt) * curve_factor > c2 = c3 + (c0 - c3).rotate(tilt) * curve_factor > # actually centre part should be thinner, but that would require another curve segment > > elts = [Path.MoveTo(c0)] > tips = [] > for i in range(3) : > mat = Matrix.rotate(- i / 3 * 360 / deg) > tips.append(mat.map(c0)) > elts.append(Path.CurveTo(c1, c2, c3).transform(mat)) > #end for > elts.append(Path.Close()) > triwing = Path(elts) > > How much C code would it take to do the same? I could do it in one line of C code. That is what functions are for. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo