[cairo] Getting pattern extents.

Nicola Fontana ntd at entidi.it
Tue Dec 16 02:59:51 PST 2014


Il Sun, 14 Dec 2014 13:42:43 +0200 Donn <donn.ingle at gmail.com> scrisse:

> Question: How do I get the new extents of pat now? Either via cairo or 
> by basic math? i.e. It's twice as big and has moved. How to get its new 
> top and left, right and bottom?

Hi,

from what I understood you can use cairo_matrix_transform_point() on the
old four points and by applying all the transformations you piled up on
the CTM. In your example that transformations would be:

    cairo_matrix_init_scale(transformations, 2, 2)
    cairo_matrix_translate(transformations, some_x, some_y)

If you do not have access anymore to the transformations you applied,
you can get them knowing the old and the actual CTM:

    # To be tested
    cairo_matrix_invert(old_ctm)
    cairo_matrix_multiply(transformations, ctm, old_ctm)

Ciao.
-- 
Nicola


More information about the cairo mailing list