[cairo] How to get extents of transformed graphics

Carl Worth cworth at cworth.org
Sun Sep 18 01:08:39 UTC 2022


On Sat, Sep 17 2022, Andreas Falkenhahn wrote:
> It's a bit frustrating that nobody corrected this misconception because I
> actually started my very first email on 28th August with it. I wrote:

I'm sorry you didn't get the answer you were hoping for!

But I am happy you did find an answer to your problem (eventually!). :-)

> "Is there any way to get the *exact* extents of transformed graphics?
> AFAICS, cairo_fill_extents() is in user coordinates, i.e. it doesn't
> take any transformation settings into account."

I read that original sentence from you. And it wasn't at all obvious
that you were misunderstanding anything.

> If someone had just said "Hey, cairo_fill_extents() *does* take the
> transformation settings into account" it would have spared me a lot of
> trouble :-(

I guess it's still unclear to me what "takes the transformation settings
(or not) into account" actually means.

Almost all cairo API accepts coordinates in "user space" and those
coordinates are then transformed (according to the current
transformation) to "device space".

So, the various "extents" APIs are documented (as you said) to return
coordinates in user space.

If you can recommend any additional wording that could be changed or
added to the API documentation that would have made this more clear to
you, then that could be helpful.

And don't forget to have fun with cairo!

-Carl



More information about the cairo mailing list