private void UpdateStrokeColor(SvgLib.SvgElement el, ColorManagement colorManagement) { if (el is SvgLib.SvgCircle || el is SvgLib.SvgEllipse || el is SvgLib.SvgLine || el is SvgLib.SvgPath || el is SvgLib.SvgPolygon || el is SvgLib.SvgPolyline || el is SvgLib.SvgRectangle) { var stroke = (el as SvgLib.SvgVisualElement).Stroke; if (stroke != null) { System.Drawing.Color color; if (StrokeColor is RgbColor) { color = StrokeColor.ToGdiPlusColor(); } else { colorManagement = colorManagement ?? GetColorManagement(true); color = ColorManagement.GetPreviewColor(colorManagement, _strokeColor); } (stroke as SvgLib.SvgColourServer).Colour = color; } } if (el.HasChildren()) { foreach (var ch in el.Children) { UpdateStrokeColor(ch, colorManagement); } } }
private System.Drawing.Color GetStrokeColorFromSvg(SvgLib.SvgElement el) { if (el is SvgLib.SvgVisualElement) { var stroke = (el as SvgLib.SvgVisualElement).Stroke; if (stroke != null) { return((stroke as SvgLib.SvgColourServer).Colour); } } if (el.HasChildren()) { foreach (var ch in el.Children) { var result = GetStrokeColorFromSvg(ch); if (!result.IsEmpty) { return(result); } } } return(System.Drawing.Color.Empty); }