[cairo] Getting pattern extents.

Nicola Fontana ntd at entidi.it
Tue Dec 16 09:30:40 PST 2014

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

> Nicola,
>   I have produced some code (in vala) using your suggestion. The attached
> image shows what's happening.

I admit it has been difficult to understand the code... too many nested
save/restore pairs for my limited memory.

Anyway I found 2 errors. The first one:

> [...]
>            ctm.multiply(ctm,otm); //ctm is now changed. ctm = ctm * otm

should be ctm.multiply(otm,ctm) (sorry, my bad). Then just before using
ce1 and ce2 you should apply the identity matrix (as you already did for
the original bounding box):

> [...]
>            //Try drawing something with these numbers:
>              cr.set_source_rgb(1,0,1);
>              cr.rectangle( cex1, cey1, cex2-cex1, cey2-cey1);
>              cr.stroke();
> [...]

After that the two red dots will be rendered in the correct position. To
get the whole bounding box you should apply the same transformation to
the other two corners.


More information about the cairo mailing list