[cairo] Getting pattern extents.

Nicola Fontana ntd at entidi.it
Tue Dec 16 12:06:17 PST 2014


Il Tue, 16 Dec 2014 20:51:31 +0200 Donn <donn.ingle at gmail.com> scrisse:

> On 16/12/2014 19:30, Nicola Fontana wrote:
> 
> I wish my theoretical background included this matrix stuff. High school 
> stopped at Calculus ... and that was over twenty years ago! :D Me and 
> math just don't get along.

Same here ;)

The only thing you need to know is that

    matrix.transform_point(ref x, ref y);
    matrix.invert();
    matrix.transform_point(ref x, ref y);

is effectively a no-op, that is applying an inverted matrix to a point
"strips" the effects of that matrix from the point.

In your case I strip the original matrix (otm) and appy the new matrix
(ctm) to be able to use the point in the identity space, that is:

    otm.invert();
    otm.transform_point(ref x, ref y);
    ctm.transform_point(ref x, ref y);

and the above code is exactly equivalent [1] to the provided one.

Ciao.
-- 
Nicola

[1] http://cairographics.org/manual/cairo-cairo-matrix-t.html#cairo-matrix-multiply


More information about the cairo mailing list