#include #include /* Any non-zero value here will lead to a wrong result */ #define ORIG -10 int main() { double x, y, w, h; cairo_rectangle_t rect = { ORIG, ORIG, 20, 20 }; cairo_surface_t *s = cairo_recording_surface_create (CAIRO_CONTENT_COLOR, &rect); cairo_t *cr = cairo_create (s); cairo_paint (cr); cairo_destroy (cr); cairo_recording_surface_ink_extents (s, &x, &y, &w, &h); cairo_surface_destroy (s); printf ("Surface: (%g, %g), size (%g, %g)\n", rect.x, rect.y, rect.width, rect.height); printf ("Ink: (%g, %g), size (%g, %g)\n", x, y, w, h); return 0; }