cairo_t *ct = cairo_create(); cairo_set_target_image (ct, image, CAIRO_FORMAT_ARGB32, width, height, stride); /* Draw things with cairo ... */ cairo_destroy (ct);