[cairo] Qahirah: A High-Level Cairo API Binding For Python 3
Dan Raymond
draymond at foxvalley.net
Wed Mar 11 16:34:41 PDT 2015
On 3/11/2015 5:09 PM, Lawrence D'Oliveiro wrote:
> Besides, I think my version has fewer statements than yours. Remember
> that
>
> (qah.Context(tile)
> .set_matrix(Matrix.scale(pattern_res) * Matrix.translate(- path_bounds.topleft))
> .set_source_colour(Colour.grey(1))
> .set_operator(CAIRO.OPERATOR_SOURCE)
> .paint()
> .set_source_colour(Colour.grey(0))
> .new_path()
> .append_path(shape)
> # need enough copies to cover neighbouring spots under all possible pattern parameters
> .append_path(shape.transform(Matrix.translate(tips[2] - tips[1])))
> .append_path(shape.transform(Matrix.translate(tips[0] - tips[1])))
> .append_path(shape.transform(Matrix.translate((+ pattern_dimensions.x, 0))))
> .append_path(shape.transform(Matrix.translate((- pattern_dimensions.x, 0))))
> .append_path(shape.transform(Matrix.translate(tips[1] - tips[2])))
> .append_path(shape.transform(Matrix.translate(tips[1] - tips[0])))
> .fill()
> )
>
> is technically one Python statement.
LOL, I don't think anything more needs to be said.
More information about the cairo
mailing list