Attach user data to surface. To remove user data from a surface, call this function with the key that was used to set it and NULL for data. Since 1.0

class Surface
void* userData
cairo_destroy_func_t destroy


key cairo_user_data_key_t*

the address of a cairo_user_data_key_t to attach the user data to

userData void*

the user data to attach to the surface

destroy cairo_destroy_func_t

a cairo_destroy_func_t which will be called when the surface is destroyed or when new user data is attached using the same key.

Return Value

CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY if a slot could not be allocated for the user data.