SKCanvas.DrawCircle()绘制正方形

时间:2018-12-04 23:52:10

标签: c# .net-core opentk skiasharp

我使用OpenGL在.NetCore中设置了SkiaSharp。如果我调用 DrawCircle()函数,它将渲染正方形,这看起来很奇怪。我的代码如下:

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 );

}

然后,屏幕如下所示: enter image description here

为什么有正方形?

1 个答案:

答案 0 :(得分:1)

所以我不小心通过添加抗锯齿来解决此问题。

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

enter image description here