Reputation: 450
For an image editing application i'm trying to draw a gradient around a closed natural cubic spline.
The spline is drawn according to the algorithm and code explained here.
The outcome should look like this (created with GIMP using lots of gaussian blur).
As i could not find any suitable algorithm to determine the distance from the spline, i tought of the following algorithm:
As you can see, this solution is quite complex (will probably have to rely on OpenGL) and hence suboptimal.
Can anybody come up with a simpler solution?
Thanks in advance.
Upvotes: 2
Views: 352
Reputation: 80325
It seems you need to build distance transform map outside the spline. Some code for doing it. It is implemented in OpenCV library too.
Upvotes: 2