[cairo] API completeness of reference/user_data pairs
xfurious at gmail.com
Mon Jan 29 20:39:28 PST 2007
On Mon, 2007-01-29 at 16:13 -0500, Behdad Esfahbod wrote:
> I wanted to propose new API for cairo_font_options_reference().
> I reported this in bugzilla somewhere, but can't find it.
> In short, I think the required malloc for an opaque value type is
> unnecessary overhead.
> But when I thought about it, I remembered that to make life
> easier for language bindings, all referenced types need to have
> destroy notification for the least, and user data preferably. In
> cairo, both are available using the user_data idiom.
Why does user data help bindings again?
> However, it seems like from the five referenced types in cairo:
> $ grep '^cairo.*_reference' cairo.h
> cairo_reference (cairo_t *cr);
> cairo_font_face_reference (cairo_font_face_t *font_face);
> cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);
> cairo_surface_reference (cairo_surface_t *surface);
> cairo_pattern_reference (cairo_pattern_t *pattern);
> Only two have user_data:
> $ grep '^cairo.*_set_user_data' cairo.h
> cairo_font_face_set_user_data (cairo_font_face_t *font_face,
> cairo_surface_set_user_data (cairo_surface_t *surface,
> Is there any reason that the other three don't have user_data?
> How do language bindings deal with this currently?
The bindings I wrote for Mono/C# (Portal.CLI) don't make use of user data.
More information about the cairo