I read a bit about it and it seems there are no dotted or dashed strokes in nanovg. I could do something for straight lines myself without much effort but I want an ellipsis to be drawn dotted. Is there an obvious solution that I missed or does someone have something already ready to use?
Not that I know of. You’ll have to make several line segments manually.
Ok thanks. Let’s see what I come up with…
Be interesting to see what you come up with.
Little to no explanation to this video.
For curved lines, particularly the bezier curves, you could start with deCasteljau’s algorithm.
It’s fast, but it will only get you to a partial solution, because it’s difficult to calculate the length of a bezier curve, and the velocity of the curve is not constant along it’s length.
I used this algorithm for the candystriped cables that I did. But the dashes are not consistent lengths, they tend to be longer in the center of the curve than at the ends. And I only approximated the curve length from the bounding triangle of the curve.