[cairo] Reflection/mirror transformation

Nicola Fontana ntd at entidi.it
Wed Jan 14 11:50:01 PST 2009


On Wed, 14 Jan 2009 20:16:34 +0100
Nicola Fontana <ntd at entidi.it> wrote:

> Hi all,
> 
> the reflection around an arbitrary { y = x * tan angle } axis
> can be get using the following matrix:
> 
> [cos 2angle, sin 2angle, sin 2angle, -cos 2angle, 0, 0]
> 
> I'm aware this could be obtained from a combination of other
> transformations (although I don't know how), but I think this
> operation is so common it is worth a discussion.

Well, it came out this reflection is quite trivial to do with the
current API:

cairo_matrix_init_rotate(matrix, angle);
cairo_matrix_scale(matrix, 1.0, -1.0);
cairo_matrix_rotate(matrix, -angle);

Maybe a mention in the cairo_matrix_scale() documentation is
enough...

-- 
Nicola


More information about the cairo mailing list