#include#include int main() { cairo_t* cr = cairo_create(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 640, 480)); RefPtr cr_ptr(cr); ... }
void my_draw_function(RefPtrIn this example, we pass a RefPtr to a function. The function can access the cairo_t object by calling the get() method on the RefPtr. The Cairo graphics library is part of the GTK+ toolkit, an open-source package that provides a comprehensive set of tools for building graphical applications.cr_ptr) { cairo_t* cr = cr_ptr.get(); ... } int main() { cairo_t* cr = cairo_create(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 640, 480)); RefPtr cr_ptr(cr); my_draw_function(cr_ptr); ... }