public static CircleDrawable Create(SvgCircle svgCircle, SKRect skViewport, DrawableBase?parent, IAssetLoader assetLoader, HashSet <Uri>?references, DrawAttributes ignoreAttributes = DrawAttributes.None) { var drawable = new CircleDrawable(assetLoader, references) { Element = svgCircle, Parent = parent, IgnoreAttributes = ignoreAttributes }; drawable.IsDrawable = drawable.CanDraw(svgCircle, drawable.IgnoreAttributes) && drawable.HasFeatures(svgCircle, drawable.IgnoreAttributes); if (!drawable.IsDrawable) { return(drawable); } drawable.Path = svgCircle.ToPath(svgCircle.FillRule, skViewport); if (drawable.Path is null || drawable.Path.IsEmpty) { drawable.IsDrawable = false; return(drawable); } drawable.Initialize(references); return(drawable); }
public static CircleDrawable Create(SvgCircle svgCircle, Rect skOwnerBounds, DrawableBase?parent, IAssetLoader assetLoader, Attributes ignoreAttributes = Attributes.None) { var drawable = new CircleDrawable(assetLoader) { Element = svgCircle, Parent = parent, IgnoreAttributes = ignoreAttributes }; drawable.IsDrawable = drawable.CanDraw(svgCircle, drawable.IgnoreAttributes) && drawable.HasFeatures(svgCircle, drawable.IgnoreAttributes); if (!drawable.IsDrawable) { return(drawable); } drawable.Path = svgCircle.ToPath(svgCircle.FillRule, skOwnerBounds); if (drawable.Path is null || drawable.Path.IsEmpty) { drawable.IsDrawable = false; return(drawable); } drawable.IsAntialias = SvgModelExtensions.IsAntialias(svgCircle); drawable.TransformedBounds = drawable.Path.Bounds; drawable.Transform = SvgModelExtensions.ToMatrix(svgCircle.Transforms); var canDrawFill = true; var canDrawStroke = true; if (SvgModelExtensions.IsValidFill(svgCircle)) { drawable.Fill = SvgModelExtensions.GetFillPaint(svgCircle, drawable.TransformedBounds, assetLoader, ignoreAttributes); if (drawable.Fill is null) { canDrawFill = false; } } if (SvgModelExtensions.IsValidStroke(svgCircle, drawable.TransformedBounds)) { drawable.Stroke = SvgModelExtensions.GetStrokePaint(svgCircle, drawable.TransformedBounds, assetLoader, ignoreAttributes); if (drawable.Stroke is null) { canDrawStroke = false; } } if (canDrawFill && !canDrawStroke) { drawable.IsDrawable = false; return(drawable); } // TODO: Transform _skBounds using _skMatrix. drawable.TransformedBounds = drawable.Transform.MapRect(drawable.TransformedBounds); return(drawable); }