[cairo] cairo_path_extents() question

Cosmin Apreutesei cosmin.apreutesei at gmail.com
Sun Oct 7 17:53:36 PDT 2012


Hi,

I can't seem to understand how cairo_path_extents() work. Can anyone
please tell me what I'm doing wrong?

Here's a code sample (in Lua):

cr:identity_matrix()
cr:rotate(math.pi/4)
cr:arc(0, 0, 50, 0, math.pi*2)
print(cr:path_extents())

The printout is:
-70.716202390383	-70.713440254519	70.710678118655	70.713440254519

What I don't understand is how can a circle's bounding box be getting
bigger because I rotate the space? It only happens if the matrix's xy
!= 0 or yx != 0 (so it doesn't happen with translation, scaling or
rotation of multiples of pi/2). I tried path_extents, fill_extends,
stroke_extents, tried with lines, rectangle, circle, the result is the
same. I don't get it :) Can someone please illuminate me? Thanks.

PS: As another example, a square at (0,0,100,100) rotated 45 degrees
around (0,0) gives a bounding box of (-50,-50,150,150). I was
expecting a width of 100*sqrt(2).


More information about the cairo mailing list