I have two curves, one inside another, for example ellipse inside circle. I need to create gradient between them.
Here is formula for better explanation:
d_e = min_dist(ellipse,pixel)
d_c = min_dist(circle,pixel)
pixel_color = (e_color * d_e + c_color * d_c) / (d_e + d_c)
Cairo only has radial patterns which are defined by two circles, not an ellipse and a circle.
The other alternatives are mesh gradients (new in cairo 1.12), but for this you would need to calculate a piecewise approximation yourself. Sounds hard and would only be a rough approximation.
So I guess the best suggestions that I can make is: Draw that thing yourself by setting the individual pixels yourself and use the result as an image surface.