xamarin - SkiaSharp does not fill triangle with StrokeAndFill -


i trying draw , fill triangle. referred android - question how draw filled triangle on android canvas , did following. draws triangle doesn’t fill it. how filled? also, possible filled different color line color?

xamarin forms

private void onpainting(object sender, skpaintsurfaceeventargs e) {         var surface = e.surface;         var canvas = surface.canvas;         canvas.clear(skcolors.white);           var pathstroke2 = new skpaint         {             isantialias = true,             style = skpaintstyle.strokeandfill,             color = new skcolor(244, 0, 110, 200),             strokewidth = 5         };          var path2 = new skpath { filltype = skpathfilltype.evenodd };         path2.moveto(0, 0);         path2.lineto(0, 140);         path2.moveto(0, 140);         path2.lineto(140, 140);         path2.moveto(140, 140);         path2.lineto(0, 0);         path2.close();         canvas.drawpath(path2, pathstroke2);      } 

enter image description here

you don't need use both lineto() , moveto() - suspect doing breaking fill algorithm. instead, use

path2.moveto(0, 0); path2.lineto(0, 140); path2.lineto(140, 140); path2.lineto(0, 0); path2.close(); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -