views:

356

answers:

1
+2  A: 

Oh. Did it. The idea is to create an OpacityMask out of your holes using DrawingBrush and then push it on the drawing context before drawing the PathGeometry. Something like this.

RectangleGeometry r = new RectangleGeometry(graphVisual.Bounds);
GeometryDrawing dr = new GeometryDrawing(Brushes.Black, null, Geometry.Combine(r, bulletHoles, GeometryCombineMode.Exclude, null));
DrawingBrush br = new DrawingBrush(dr);
drawingContext.PushOpacityMask(br);

drawingContext.DrawGeometry(null, new Pen(Brushes.Green, 2), graphVisual);

drawingContext.Pop();
Alan Mendelevich