mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.51k stars 537 forks source link

skpath.arcto svg method wont draw arc where start and and ponts are the same #2182

Open fbd-ss opened 2 years ago

fbd-ss commented 2 years ago

this method SkiaApi.sk_path_arc_to(this.Handle, rx, ry, xAxisRotate, largeArc, sweep, x, y);

has a problem as per title.

this wont work.

path.MoveTo( new SKPoint( 68.404f, 187.938f ) ); path.ArcTo( 100.0f, 200.0f, 160.0f, SKPathArcSize.Large, SKPathDirection.Clockwise, 68.404f, 187.938f );

but modifying the end point by 0.0005 in x and y seems to work for some reason as per

path.MoveTo( new SKPoint( 68.404f, 187.938f ) );

path.ArcTo( 100.0f, 200.0f, 160.0f, SKPathArcSize.Large, SKPathDirection.Clockwise, 68.4045f, 187.9385f );

themcoo commented 1 year ago

This is not a SkiaSharp bug, this works exactly as the native skia api is documented:

Arc sweep is always less than 360 degrees. arcTo() appends line to (x, y) if either radii are zero, or if last SkPath SkPoint equals (x, y). arcTo() scales radii (rx, ry) to fit last SkPath SkPoint and (x, y) if both are greater than zero but too small.