[cairo] cairo_get_reference (), cairo_pattern_reference (), etc.

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Fri Aug 20 12:54:10 PDT 2010


On Fri, 20 Aug 2010, Daniel Goldman wrote:

> There are various cairo functions with "reference" or "reference_count" in the 
> name. It's obvious how to use "destroy" functions to decrease the reference 
> count. But when might I want to use "reference" functions to INCREASE the 
> reference count?

One case might be in language bindings where you might have multiple 
language objects pointing at the same cairo object.  Another might be 
in a cache of cairo objects where both the cache and the users of the 
cached objects might own references the object.

> Are the "reference" functions intended for a user such as myself 
> writing an application? Or are they an internal thing intended for 
> use by other library functions?

Yes, they're meant for you as a user.  All functions beginning with 
cairo_* are public functions.  Others beginning with _cairo_* are 
library private ones.

Cheers,

Joonas


More information about the cairo mailing list