public static UseDrawable Create(SvgUse svgUse, SKRect skViewport, DrawableBase?parent, IAssetLoader assetLoader, HashSet <Uri>?references, DrawAttributes ignoreAttributes = DrawAttributes.None) { var drawable = new UseDrawable(assetLoader, references) { Element = svgUse, Parent = parent, IgnoreAttributes = ignoreAttributes }; drawable.IsDrawable = drawable.CanDraw(svgUse, drawable.IgnoreAttributes) && drawable.HasFeatures(svgUse, drawable.IgnoreAttributes); if (!drawable.IsDrawable) { return(drawable); } if (SvgExtensions.HasRecursiveReference(svgUse, (e) => e.ReferencedElement, new HashSet <Uri>())) { drawable.IsDrawable = false; return(drawable); } var svgReferencedElement = SvgExtensions.GetReference <SvgElement>(svgUse, svgUse.ReferencedElement); if (svgReferencedElement is null) { drawable.IsDrawable = false; return(drawable); } var x = svgUse.X.ToDeviceValue(UnitRenderingType.Horizontal, svgUse, skViewport); var y = svgUse.Y.ToDeviceValue(UnitRenderingType.Vertical, svgUse, skViewport); var width = svgUse.Width.ToDeviceValue(UnitRenderingType.Horizontal, svgUse, skViewport); var height = svgUse.Height.ToDeviceValue(UnitRenderingType.Vertical, svgUse, skViewport); if (width <= 0f) { width = new SvgUnit(SvgUnitType.Percentage, 100f).ToDeviceValue(UnitRenderingType.Horizontal, svgUse, skViewport); } if (height <= 0f) { height = new SvgUnit(SvgUnitType.Percentage, 100f).ToDeviceValue(UnitRenderingType.Vertical, svgUse, skViewport); } var originalReferencedElementParent = svgReferencedElement.Parent; try { if (s_referencedElementParent is { }) { s_referencedElementParent.SetValue(svgReferencedElement, svgUse); } }