xamarin - SkiaSharp ArcTo Method does not draw curve -
i trying draw arc on skiasharp canvas view using following code.
path3.arcto(new skpoint(0, h/2), 1.57f, skpatharcsize.large, skpathdirection.clockwise, new skpoint(w/2, h));
but instead of curve, drawing straight line. how make curve?
complete code
private void onpainting(object sender, skpaintsurfaceeventargs e) { var surface = e.surface; var canvas = surface.canvas; canvas.clear(skcolors.white); var w = e.info.width; var h = e.info.height; var pathstroke3 = new skpaint { isantialias = true, style = skpaintstyle.strokeandfill, color = new skcolor(240, 0, 100, 250), strokewidth = 5 }; var path3 = new skpath { filltype = skpathfilltype.evenodd }; path3.moveto(0, h/2); path3.arcto(new skpoint(0, h/2), 1.57f, skpatharcsize.large, skpathdirection.clockwise, new skpoint(w/2, h)); path3.lineto(0, h); path3.close(); canvas.drawpath(path3, pathstroke3); }
xaml
<grid x:name="controlgrid" columnspacing="0" rowspacing="0" padding="0" backgroundcolor="white" > <grid.rowdefinitions> <rowdefinition height="4*" /> <rowdefinition height="6*" /> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="*" /> </grid.columndefinitions> <views:skcanvasview paintsurface="onpainting" enabletouchevents="true" touch="ontouch" heightrequest="300" grid.row="0"/> </grid>
your x
radius zero, arcto
adds line path current point exit point.
arcto appends line xy if either radii zero, or if last path point equals (x, y). arcto scales radii r fit last path point , xy if both greater 0 small.
you can like:
path3.arcto(new skpoint(100, 100), 0, skpatharcsize.large, skpathdirection.clockwise, new skpoint(w / 2, h));
but not know drawing intent is; concave, convex, bounded, unbounded, etc... other examples using conicto
might closer think intent might be:
path3.conicto(w / 3, h / 2, w / 2, h, 0.50f);
path3.conicto(0, h - (h / 5), w / 2, h, 0.50f);
you might want @ official docs understand how arcto
resolves arcs, conics , moves:
Comments
Post a Comment