private PageElement VisitPathSegList(SvgGraphicsElement graphicsElement, SvgPathSegList paths) { if (!IsVisible(graphicsElement)) { return(null); } var result = new Group(); PushTransformsMatrix(graphicsElement.Transform); var innerMatrix = CurrentMatrix; var pathsToDraw = paths .ConvertToAbsolute() .ConvertAllLinesAndCurvesToCubicCurves() .MultiplyByMatrix(CurrentMatrix); var fillOpacity = Math.Max(0, Math.Min(1, graphicsElement.Style.FillOpacity)); var strokeOpacity = Math.Max(0, Math.Min(1, graphicsElement.Style.StrokeOpacity)); var svgToPdfPathConverter = new SvgPathSegToDynamicPdfPathsConverter(graphicsElement, _pageViewport, _pageHeight, _spotColorOverride); bool IsPaintedPath(Path path) => path.FillColor != null || path.LineColor != null; if (Math.Abs(fillOpacity - 1) > float.Epsilon || Math.Abs(strokeOpacity - 1) > float.Epsilon) { var fillGroup = new TransparencyGroup(fillOpacity * _groupAlpha); svgToPdfPathConverter.SetStrokeStyle(null); pathsToDraw.ForEach(i => i.Accept(svgToPdfPathConverter)); fillGroup.AddRange(svgToPdfPathConverter.Paths.Where(IsPaintedPath)); svgToPdfPathConverter.Reset(); svgToPdfPathConverter.SetFillStyle(null); svgToPdfPathConverter.SetStrokeStyle(graphicsElement); var strokeGroup = new TransparencyGroup(strokeOpacity * _groupAlpha); pathsToDraw.ForEach(i => i.Accept(svgToPdfPathConverter)); strokeGroup.AddRange(svgToPdfPathConverter.Paths.Where(IsPaintedPath)); result.Add(fillGroup); result.Add(strokeGroup); } else { pathsToDraw.ForEach(i => i.Accept(svgToPdfPathConverter)); result.AddRange(svgToPdfPathConverter.Paths.Where(IsPaintedPath)); } PopTransformsMatrix(graphicsElement.Transform); return(result.Count == 0 ? null : CheckAndApplyClipPath(graphicsElement, result, innerMatrix)); }
public override PageElement VisitGElement(SvgGElement element) { if (!IsVisible(element)) { return(null); } var ownOpacity = element.PresentationStyleData.FillOpacity; if (ownOpacity != null) { var oldGAlpha = _groupAlpha; _groupAlpha *= ownOpacity.Value; var result = new TransparencyGroup(_groupAlpha) { VisitStructuralElement(element) }; _groupAlpha = oldGAlpha; return(result); } return(VisitStructuralElement(element)); }