SKCanvas.DrawCircle() 正在绘制正方形
SKCanvas.DrawCircle() is drawing squares
我使用 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 );
}
然后屏幕看起来像这样:
为什么会有正方形?
所以我不小心通过添加抗锯齿解决了这个问题。
using (SKPaint paint = new SKPaint {
...,
...,
IsAntialias = true
}) {
...
}
我使用 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 );
}
然后屏幕看起来像这样:
为什么会有正方形?
所以我不小心通过添加抗锯齿解决了这个问题。
using (SKPaint paint = new SKPaint {
...,
...,
IsAntialias = true
}) {
...
}