Question

I have a requirement for 2D geometric boolean operations in a non-WPF application. I know you can use WPF assebmlies in a non-WPF application. Can the CombinedGeometry and PathGeometry object be used to perform boolean operations on geometric data? Currently I am doing my boolean operations manually, and it is very unstable. I was hoping to increase stability (albeit at the expense of performance) by using these objects.

Was it helpful?

Solution

CombinedGeometry has a GetFlattenedPathGeometry method that returns an ordinary PathGeometry so assuming you can convert between your representation and WPF's Figures and Segments the results of the combine operation should be available to your application. I briefly tested with a WinForms app and didn't encounter any problems. You may want to consider if parsing and generating the Path Markup Syntax is easier or more complex than traversing the object hierarchy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top