internal static List <Vector2[]> TraceNodeHierarchyShapes(SceneNode root, TessellationOptions tessellationOptions) { var shapes = new List <Vector2[]>(); foreach (var nodeInfo in WorldTransformedSceneNodes(root, null)) { var node = nodeInfo.Node; // We process the drawables even though they are obsolete, until we remove the IDrawable interface entirely if (node.Drawables != null) { foreach (var drawable in node.Drawables) { var vectorShape = drawable as Shape; if (vectorShape != null) { foreach (var c in vectorShape.Contours) { var shape = VectorUtils.TraceShape(c, vectorShape.PathProps.Stroke, tessellationOptions); if (shape.Length > 0) { shapes.Add(shape.Select(v => nodeInfo.WorldTransform * v).ToArray()); } } continue; } var vectorPath = drawable as Path; if (vectorPath != null) { var shape = VectorUtils.TraceShape(vectorPath.Contour, vectorPath.PathProps.Stroke, tessellationOptions); if (shape.Length > 0) { shapes.Add(shape.Select(v => nodeInfo.WorldTransform * v).ToArray()); } continue; } var vectorRect = drawable as Rectangle; if (vectorRect != null) { var shape = VectorUtils.TraceRectangle(vectorRect, vectorRect.PathProps.Stroke, tessellationOptions); if (shape.Length > 0) { shapes.Add(shape.Select(v => nodeInfo.WorldTransform * v).ToArray()); } continue; } } } if (node.Shapes != null) { foreach (var shape in node.Shapes) { foreach (var c in shape.Contours) { var tracedShape = VectorUtils.TraceShape(c, shape.PathProps.Stroke, tessellationOptions); if (tracedShape.Length > 0) { shapes.Add(tracedShape.Select(v => nodeInfo.WorldTransform * v).ToArray()); } } } } } return(shapes); }