Forum Cross Platform with Xamarin

Why is my SKPath DrawPath so slow?

ArcadianLightArcadianLight Member ✭✭

I am trying to display my polygon manually instead of using SKSvg to display my ,svg so that I can update the colours manually, It is data bound to tow sliders for X/Y movement for testing purposes. Here is the drawing code:

// Class variables loaded at load time
List<float> ldPoints = new List<float>() { 33.8f, 46f, 22.5f, 36.5f, 8.4f, 40.5f, 13.8f, 26.8f, 5.7f, 14.6f, 20.4f, 15.6f, 29.5f, 4.1f, 33.1f, 18.3f, 46.9f, 23.4f, 34.4f, 31.3f };
List<SKPoint> lSKPoints = new List<SKPoint>();     

void Load(...)
{
    // Load ldPoints into lSKPoints 
}

CanvasViewOnPaintSurface(...) 
{
    // ... after all transforms

    SKPath path = new SKPath { FillType = SKPathFillType.EvenOdd };
    path.MoveTo(100, 100);

    foreach(SKPoint p in lSKPoints)
    {
        path.LineTo(p);
    }

    path.Close();
    mCanvas.DrawPath(path, redFillPaint);
}

It actually draws a star with the final point drawn far away from the rest. of where it should be rather. Any suggestions for a better way to display .svg files in order for them to be editable - do please advise, thank you humbly.

Best Answer

  • ArcadianLightArcadianLight Member ✭✭
    edited February 10 Accepted Answer

    Sorry my mistake. I was drawing some other stuff that slowed it down terribly.

Answers

  • ArcadianLightArcadianLight Member ✭✭
    edited February 10 Accepted Answer

    Sorry my mistake. I was drawing some other stuff that slowed it down terribly.

  • ColeXColeX Member, Xamarin Team Xamurai

    @ArcadianLight Could you mark it as answer if problem has been solved ?

Sign In or Register to comment.