Hello!
I'm using an SkPath to draw some Bezier curve and I have to detect when the user clicks on it. However, since the path is not closed, it's a 1 pixel width which makes it difficult to click. I wanted to increase the tolerance (to a couple of pixels around the path), so that I can detect when the user clicks close to the path.
I googled for a bit and found a potential solution here:
https://github.com/unoplatform/uno/discussions/17737.
Two solutions are proposed at the bottom:
- Create a closed path which takes into account this tolerance
- Create a SkPaint with a certain stroke with and use GetFillPath
The first approach is actually not straightforward to implement, because simply offseting the curve a couple of pixels above and below the original curve will not work in all situations (e.g. if the Bezier curve is rather vertical, the center area will still be very thin).
So, I wanted to go with the second solution (which is also more elegant IMO), but to my surprise, I could not find any GetFillPath method in the C++ API for SkPaint. Is this method specific for SkiaSharp only? Or was this method moved/deleted?
Any other suggestion on how I could implement this?
Thank you,
Cédric