Search code examples
c#.net-coreopentkskiasharp

SKCanvas.DrawCircle() is drawing squares


I setup SkiaSharp in .NetCore using OpenGL. If I call the DrawCircle() function it renders squares, which seems weird. My code looks like this:

using (SKPaint paint = new SKPaint {
    Style = SKPaintStyle.Stroke,
    Color = SKColors.Red,
    StrokeWidth = 25,
}) {
    canvas.RotateDegrees( 2 );
    canvas.DrawCircle( info.Width / 2, info.Height / 2, 100, paint );
    paint.Style = SKPaintStyle.Fill;
    paint.Color = SKColors.Blue;
    canvas.DrawCircle( info.Width / 2, info.Height / 2, 75, paint );

    canvas.RotateDegrees( 20 );
    canvas.DrawCircle( info.Width / 2, info.Height / 2, 50, paint );
    paint.Style = SKPaintStyle.Fill;
    paint.Color = SKColors.Yellow;
    canvas.DrawCircle( info.Width / 2, info.Height / 2, 25, paint );

}

The screen then looks like this: enter image description here

Why are there squares?


Solution

  • So I accidentally fixed this issue by adding anti aliasing.

    using (SKPaint paint = new SKPaint {
         ...,
         ...,
         IsAntialias = true
    }) {
         ...
    }
    

    enter image description here