Forum Cross Platform with Xamarin

Fastest 2d polygon draw method?

Dear Xamarin forum users,

Please would you suggest the fastest way to draw an immense amount of 2d polygons. I've tried SKPath but it involves repeated method calls per point! Is there a faster skiasharp facility for batch drawing loads of polygons?

Many thanks in advance.

Best Answer

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    Accepted Answer

    Please add Forms.SetFlags("Shapes_Experimental"); in the onCreate() method of MainActivity.cs like following screenshot.

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    You can use Xamarin.Forms Shapes: Polygon control to draw 2d polygons directly(but you need to know all of Points) like following link.

    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/shapes/polygon

    And you do not need to repeated method calls, just use this control your xaml code.


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

  • ArcadianLightArcadianLight Member ✭✭

    Intellisense shows Xamarin.Forms.Shapes.Polygon to be not yet added!?! The dependencies that I have are:
    Skiasharp.Svg (1.60.0)
    Skiasharp.Views.Forms (2.80.2)
    Xamarin.Essentials (1.6.1)
    Xamarin.Forms (5.0.0.1931)

    I don't think that I'm missing anything!?!

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    Accepted Answer

    Please add Forms.SetFlags("Shapes_Experimental"); in the onCreate() method of MainActivity.cs like following screenshot.

  • ArcadianLightArcadianLight Member ✭✭

    Thanks @LeonLu for your solution.

Sign In or Register to comment.