Reputation: 8375
I am trying to create a remote control but not sure how to draw a path with an arc like the image below.
I considered to use SKPath.DrawArc to do the drawing of that button. When user click on a the screen, I can compare the touch point is inside the SKPath. At the moment, I don't know how to use the SKPath to draw the arc like in the photo.
Upvotes: 3
Views: 1860
Reputation: 5212
I am looking to create an additional library that contains helpful bits for SkiaSharp. Nothing to release yet, but drawing these shapes/arcs/sectors is one of the features in development.
Here is my code that will create the arc: https://github.com/mono/SkiaSharp/blob/322baee72a018a889e85fc48b42cde9764797dae/source/SkiaSharp.Extended/SkiaSharp.Extended.Shared/SKGeometry.cs#L19-L79
You will use it like:
SKPath path = SKGeometry.CreateSectorPath(0.625f, 0.875f, 100f, 50f);
This code is not yet available in a NuGet, nor do I think it will be in the very near future. But, you can go ahead and just add it into your app.
Upvotes: 4