Re: clipmask of multiple rects in different angles

Lawrence D'Oliveiro <[email protected]>
Newsgroups gmane.comp.lib.cairo
Organization Geek Central
Message-ID <[email protected]>
On Wed, 20 Jul 2016 13:44:49 +0200, Enrico Weigelt, metux IT consult
wrote:

> But what about transformation matrices ? When are they applied ?
> For each draw new path element (cairo_rectangle, etc) or only on the
> final path ?

    import sys
    import qahirah as qah

    in_path = qah.Rect(-100, -100, 200, 200).to_path()

    ctx = qah.Context.create_for_dummy()
    out_path = \
        (ctx.new_path()
            .set_matrix(qah.Matrix.rotate(45 * qah.deg))
            .append_path(in_path)
            .set_matrix(qah.Matrix.identity)
            .copy_path()
        )

    sys.stdout.write("in_path = {}\n".format(in_path))
    sys.stdout.write("out_path = {}\n".format(out_path))

produces output

    in_path = Path((Path.Segment([Path.Point(Vector(-100, -100), False), Path.Point(Vector(100, -100), False), Path.Point(Vector(100, 100), False), Path.Point(Vector(-100, 100), False)], True),))
    out_path = Path((Path.Segment([Path.Point(Vector(0, -141.422), False), Path.Point(Vector(141.422, 0), False), Path.Point(Vector(0, 141.422), False), Path.Point(Vector(-141.422, 0), False), Path.Point(Vector(0, -141.422), False)], True),))
-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.