func deviceGetID(d *C.cairo_device_t) id { p := C.cairo_device_get_user_data(d, idkey) if p == nil { panic("device does not have ID - created outside of cairo binding and not registered") } return id(ctoint(p)) }
func deviceSetID(d *C.cairo_device_t) { if C.cairo_device_get_user_data(d, idkey) != nil { return } C.cairo_device_set_user_data(d, idkey, generateID(), free) }