简体   繁体   中英

SkiaSharp: How to draw an Arc as shown in image

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.

在此输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM