このスレッドで、幅の広いパス ジオメトリを取得することについての良い議論があります。
私の場合、結果の外側の線を「丸みを帯びた」ものではなく、完全に平らにしたいと考えています。それは可能ですか?
line joins プロパティを変更しようとしましたが、結果のビジュアルに変更はありません。
問題を再現するコードは次のとおりです。
private void Window_Loaded(object sender, RoutedEventArgs e)
{
StreamGeometry geom = new StreamGeometry();
DrawLines(geom);
Pen p = new Pen(Brushes.Black, 10);
p.LineJoin = PenLineJoin.Miter;
p.EndLineCap = PenLineCap.Flat;
p.StartLineCap = PenLineCap.Flat;
PathGeometry pathGeoWidened = geom.GetWidenedPathGeometry(p);
PathGeometry pathGeom = pathGeoWidened.GetOutlinedPathGeometry();
Path myPath = new Path();
myPath.Stroke = Brushes.Black;
myPath.Data = pathGeom;
myCanvas.Children.Add(myPath);
}
private static void DrawLines(StreamGeometry geom)
{
using (var context = geom.Open())
{
context.BeginFigure(new Point(100, 100), true, true);
context.LineTo(new Point(100, 200), true, true);
context.LineTo(new Point(200, 200), true, true);
context.LineTo(new Point(200, 100), true, true);
}
}
何かご意見は?
イゴール。