gpt4 book ai didi

wpf - 如何在 DrawingImage/DrawingContext 中绘制无模糊/模糊线?

转载 作者:行者123 更新时间:2023-12-04 18:41:40 31 4
gpt4 key购买 nike

看图。我希望中间线是一条清晰的 1 像素线。您可以将示例标记复制并粘贴到 kaxaml 中。

alt text http://img832.imageshack.us/img832/1704/lines.png


<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Image SnapsToDevicePixels="True" Stretch="None">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="Red" Thickness="1"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<LineGeometry StartPoint="0,0" EndPoint="50,0"/>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="Black" Thickness="1"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<LineGeometry StartPoint="0,5.860" EndPoint="50,5.860"/>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="Black" Thickness="1"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<LineGeometry StartPoint="0,12" EndPoint="50,12"/>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Page>

最佳答案

我在以下位置找到了解决方案: http://msdn.microsoft.com/en-us/library/system.windows.media.renderoptions.setedgemode.aspx

<Image Stretch="None" RenderOptions.EdgeMode="Aliased">
RenderOptions.SetEdgeMode(this, EdgeMode.Aliased);

关于wpf - 如何在 DrawingImage/DrawingContext 中绘制无模糊/模糊线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3286214/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com