如何解决线条的宽度在 SkiaSharp 中呈现不同
我正在使用以下代码使用 SkiaSharp
中的 WPF
库绘制两条线,但是您可能会注意到两条线的宽度似乎不同,垂直线似乎有点粗。知道为什么会发生这种情况吗?
我使用的 SkiaSharp 版本是 2.80.1。
<Window
x:Class="SkiaSharpSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:skia="clr-namespace:SkiaSharp.Views.WPF;assembly=SkiaSharp.Views.WPF"
Title="SkiaSharp"
Width="525"
Height="350"
mc:Ignorable="d">
<Grid>
<skia:SKElement PaintSurface="OnPaintSurface" />
</Grid>
</Window>
private void OnPaintSurface(object sender,SKPaintSurfaceEventArgs e)
{
SKCanvas canvas = e.Surface.Canvas;
// make sure the canvas is blank
canvas.Clear(SKColors.White);
var paint = new SKPaint
{
Color = new SKColor(255,255),IsAntialias = true,Style = SKPaintStyle.stroke,strokeWidth = 0
};
canvas.DrawLine(100,100,paint);
canvas.DrawLine(100,200,paint);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。