[cairo] cairo_path_extents() question

Uli Schlachter psychon at znc.in
Mon Oct 8 07:48:32 PDT 2012


On 08.10.2012 14:06, Cosmin Apreutesei wrote:
>> I’m not sure if this answers your question, but cairo_path_extents gives a
>> result in user-space coordinates, so it is affected by any change to the
>> current transformation matrix.
> 
> In the above case there's a 45deg-rotated-around-origin space in which
> I draw a 50deg circle around origin. Shouldn't the box be 100x100
> either way? The 141x141 box looks like the result of computing the
> 100x100 box, transforming it by current matrix and then computing the
> bounding box of that box again, resulting in the 141x141 box I see.

Yeah, this is pretty much exactly what happens. Cairo tracks the path extents in
surface coordinates. When asked for some numbers, this rectangle gets
transformed via the inverse of the current user-space transformation. This is
why you get the numbers that you see.

Looking at the documentation for cairo_path_extents, it doesn't say that the
returned extents are "tight". So in theory, returning a rectangle of (INT_MIN,
INT_MIN) x (INT_MAX, INT_MAX) would be allowed. ;-)

Cheers,
Uli
-- 
- Captain, I think I should tell you I've never
  actually landed a starship before.
- That's all right, Lieutenant, neither have I.


More information about the cairo mailing list