Reputation: 695
This is quite hard for me to explain so I'll use an image as example:
I have defined a StreamGeometry (in code).
When it is drawn with DrawingContext.DrawGeometry
using both Brush to fill and Pen to stroke, the geometry is 'widened' by the Pen Thickness.
Now I'm trying to find if there is a function in WPF that can return this solid widened geometry (in any Geometry format).
So far I tried Geometry.GetWidenedPathGeometry
but that only returns geometry that 'outlines' the border Pen stroke. It has a hole where the fill should be.
I guess I can use GetWidenedPathGeometry
and do some sort of Union with the original geometry, 'filling' the hole. I just want to be sure there isn't an easier or more effective (faster) way.
Also it would be preferable if the geometry can stay a StreamGeometry, but GetWidenedPathGeometry
converts it into (somehow mangled ?) PathGeometry.
Thanks for any advice
Upvotes: 1
Views: 2474
Reputation: 1671
It seems the resulting geometry from GetWidenedPathGeometry contains two figures, one for inner and another for the outer contours.
What if you removed the inner one?
There is a similar scenario at Charles Petzold Book Blog: http://www.charlespetzold.com/blog/2008/04/Rounded-Graphics-in-WPF.html
Hope it helps.
Igor.
Upvotes: 1