[cairo] Extents not affected by CTM

rvinyard at cs.nmsu.edu rvinyard at cs.nmsu.edu
Tue Jan 27 09:22:36 PST 2009


Just checking to see it is expected behavior of cairo_fill_extents(),
cairo_path_extents() and cairo_stroke_extents() that they are (mostly)
uneffected by the CTM.

FWIW I'm using cairo 1.8.0 / cairomm 1.6.2 from Fedora 10.

If the CTM as obtained by cairo_get_matrix() is a simple translation
matrix as follows:
  xx: 1.0  yx: 0.0
  xy: 0.0  yy: 1.0
  x0: 0.0  y0: -60.0

and cairo_rectangle(cairo, 0.0, 0.0, 50, 30) is called...

cairo_fill_extents() yields x1=0.0, y1=0.0, x2=50.0, y2=30.0

cairo_stroke_extents() with a stroke of 1.0 yields x1=-1.0, y1=-1.0,
x2=51, y2=31

So, it appears that the CTM has no effect on the fill or stroke extents in
this case.

However, if I also apply a uniform scaling of 0.3, yielding a matrix as
follows:
  xx: 0.3  yx: 0.0
  xy: 0.0  yy: 0.3
  x0: 0.0  y0: -18

and the same cairo_rectangle() is called...

cairo_fill_extents() yields x1=0.0, y1=7.10543e-15, x2=50.0, y2=30.0

cairo_stroke_extents() with a stroke of 1.0 yields x1=-1.0026,
y1=-1.00026, x2=51.0026, y2=31.0026

So, the CTM does seem to have some small rounding effect, but still not
the effect as expected.

Any suggestions on how I can get the extents after the CTM is applied? I
thought about applying the CTM to the extents, but that wouldn't always
yield proper extents for cases where rotation is involved with
non-rectangular paths.

Thanks,

Rick



More information about the cairo mailing list