private void Initialize(HashSet <Uri>?references) { if (Element is not SvgGroup svgGroup) { return;; } IsAntialias = SvgExtensions.IsAntialias(svgGroup); GeometryBounds = SKRect.Empty; CreateGeometryBounds(); Transform = SvgExtensions.ToMatrix(svgGroup.Transforms); if (SvgExtensions.IsValidFill(svgGroup)) { Fill = SvgExtensions.GetFillPaint(svgGroup, GeometryBounds, AssetLoader, references, IgnoreAttributes); } if (SvgExtensions.IsValidStroke(svgGroup, GeometryBounds)) { Stroke = SvgExtensions.GetStrokePaint(svgGroup, GeometryBounds, AssetLoader, references, IgnoreAttributes); } }
private void Initialize(SKRect skViewport, HashSet <Uri>?references) { if (Element is not SvgPath svgPath || Path is null) { return; } IsAntialias = SvgExtensions.IsAntialias(svgPath); GeometryBounds = Path.Bounds; Transform = SvgExtensions.ToMatrix(svgPath.Transforms); var canDrawFill = true; var canDrawStroke = true; if (SvgExtensions.IsValidFill(svgPath)) { Fill = SvgExtensions.GetFillPaint(svgPath, GeometryBounds, AssetLoader, references, IgnoreAttributes); if (Fill is null) { canDrawFill = false; } } if (SvgExtensions.IsValidStroke(svgPath, GeometryBounds)) { Stroke = SvgExtensions.GetStrokePaint(svgPath, GeometryBounds, AssetLoader, references, IgnoreAttributes); if (Stroke is null) { canDrawStroke = false; } } if (canDrawFill && !canDrawStroke) { IsDrawable = false; return; } SvgExtensions.CreateMarkers(svgPath, Path, skViewport, this, AssetLoader, references); }
private void Initialize(HashSet <Uri>?references) { if (Element is not SvgCircle svgCircle || Path is null) { return;; } IsAntialias = SvgExtensions.IsAntialias(svgCircle); GeometryBounds = Path.Bounds; Transform = SvgExtensions.ToMatrix(svgCircle.Transforms); var canDrawFill = true; var canDrawStroke = true; if (SvgExtensions.IsValidFill(svgCircle)) { Fill = SvgExtensions.GetFillPaint(svgCircle, GeometryBounds, AssetLoader, references, IgnoreAttributes); if (Fill is null) { canDrawFill = false; } } if (SvgExtensions.IsValidStroke(svgCircle, GeometryBounds)) { Stroke = SvgExtensions.GetStrokePaint(svgCircle, GeometryBounds, AssetLoader, references, IgnoreAttributes); if (Stroke is null) { canDrawStroke = false; } } if (canDrawFill && !canDrawStroke) { IsDrawable = false; } }