func surfaceGetID(s *C.cairo_surface_t) id { p := C.cairo_surface_get_user_data(s, idkey) if p == nil { panic("surface does not have ID - created outside of cairo binding and not registered") } return id(ctoint(p)) }
func surfaceSetID(s *C.cairo_surface_t) { if C.cairo_surface_get_user_data(s, idkey) != nil { return } C.cairo_surface_set_user_data(s, idkey, generateID(), free) }