[cairo] cairo_set_user_data () and other "set_user_data" functions

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Fri Aug 20 13:37:23 PDT 2010


On Fri, 20 Aug 2010, Daniel Goldman wrote:

> When might I want to use cairo_set_user_data () and the other "set_user_data" 
> functions? I understand what cairo_set_user_data () does.

Whenever you wish to attach some non-cairo data to a cairo object.  
Typically, you'd attach a resource whose lifetime is dependent on the 
lifetime of the cairo object, thereby passing ownership of the 
resource to the cairo object.

> But I looked through 
> the docs and archive and couldn't see any examples or guidance related to 
> real-world use.

Koders.com or google code search are a great tools for finding 
real-world uses of APIs.  For instance

http://www.koders.com/default.aspx?s="cairo_surface_set_user_data"

Joonas


More information about the cairo mailing list