0
2つのシェイプオブジェクトが重なってオブジェクトの重なり部分が別のブラシでペイントされる場合、WPFには方法がありますか?2つの別々のシェイプオブジェクトのインタラクション上に別のブラシをペイントする
2つのシェイプオブジェクトが重なってオブジェクトの重なり部分が別のブラシでペイントされる場合、WPFには方法がありますか?2つの別々のシェイプオブジェクトのインタラクション上に別のブラシをペイントする
Worked it out。
EvenOddの塗りつぶし規則を持つGeometryGroupを含むジオメトリ図面を使用できます。これは、重複する項目をすべて白で塗りつぶします。次に、ジオメトリグループと同じオブジェクトを含むCombinedGeometryを上に重ねて、GeometryCombineMode Intersectを置き、カスタムブラシの交差を強調表示します。サンプルコードは次のとおりです。
<Grid>
<Image Stretch="None">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<GeometryDrawing Brush="Red">
<GeometryDrawing.Pen>
<Pen Brush="Black" Thickness="3" />
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<GeometryGroup FillRule="EvenOdd">
<EllipseGeometry RadiusX="80" RadiusY="80" Center="0,0" />
<EllipseGeometry RadiusX="80" RadiusY="80" Center="40,0" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<Image HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Stretch="None">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<GeometryDrawing Brush="LightBlue">
<GeometryDrawing.Geometry>
<CombinedGeometry GeometryCombineMode="Intersect">
<CombinedGeometry.Geometry1>
<EllipseGeometry RadiusX="80" RadiusY="80" Center="0,0" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<EllipseGeometry RadiusX="80" RadiusY="80" Center="40,0" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Grid>
ありがとうございます!