Hi everyone,
I have been testing some different methods for drawing ring gradients with Cairo. I came across the following
https://medium.com/@ramshandilya/draw-smooth-curves-through-a-set-of-points-in-ios-34f6d73c8f9
and decided to give it a try. I don't have an Apple computer so I translated the Swift code over to C and put together some test code to look at a few drawings using Cairo.
https://github.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/squiggles1.c
Ramsundar's code works very well for getting Bezier control points from a set of points. Smoothing is often done in graphing or a graphics program but it is very useful for the programmer drawing with Cairo. For a circle the smoothing function can get it very close with 24 points. This might be faster for drawing ring gradients than using trapezoids, rotated bezier curves or rotating lines from a linear gradient. Haven't got the testing that far yet though.
Besides ring gradients, getting control points from a set of points is very useful in general. My thinking is that it would be very good to have a function like this as part of Cairo?
Eric
--
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.