New build here should clip embedded SvgNode too -
https://mindfusion.eu/_beta/wpfdiag39.zip diagram.Nodes.Add(
new ClipNode
{
Node = new ShapeNode
{
Bounds = new Rect(0, 0, 160, 160),
Shape = Shapes.Star16Pointed
},
Bounds = new Rect(20, 20, 120, 120)
});
diagram.Nodes.Add(
new ClipNode
{
Node = new SvgNode
{
Bounds = new Rect(0, 0, 200, 200),
Content = SvgContent.FromFile("img.svg"),
Transparent = true
},
Bounds = new Rect(160, 60, 120, 120)
});
var svgEx = new SvgExporter();
svgEx.SetClipPaths = true;
svgEx.Export(diagram, "test.svg");
class ClipNode : DiagramNode
{
public ClipNode() {}
public override void Draw(
DrawingContext graphics, MindFusion.Diagramming.Wpf.RenderOptions options)
{
if (Node != null)
{
var maskRect = this.GetLocalBounds();
var clip = new RectangleGeometry(maskRect);
graphics.PushClip(clip);
graphics.PushTransform(new TranslateTransform(0, 0));
Node.Draw(graphics, options);
graphics.Pop();
graphics.Pop();
}
}
public DiagramNode Node { get; set; }
}
Please attach your source SVG drawing if it's still not working for you.
Regards,
Slavcho
Mindfusion