private static State <FilterChainState, XElement> BuildGaussianBlur(GaussianBlurFilter filter, CoordinatesConverter converter) { var basicElement = XElementBuilder .WithName("feGaussianBlur") .Add( new XAttribute( "stdDeviation", $"{ converter.ScaleDistance( filter.StandardDeviationX )} { converter.ScaleDistance( filter.StandardDeviationY )}")); return(basicElement.Pipe(BuildIOFilter).Select(x => x.Build())); }
private static State <FilterChainState, IEnumerable <XElement> > BuildMorphologyFilter(Morphology morphology, CoordinatesConverter converter) { var svgRadiusX = converter.ScaleDistance(morphology.RadiusX); var svgRadiusY = converter.ScaleDistance(morphology.RadiusY); var core = XElementBuilder.WithName("feMorphology") .Add( new XAttribute("radius", $"{svgRadiusX} {svgRadiusY}"), new XAttribute("operator", morphology.MorphologyType.ToString()) ); return(BuildIOFilter(core).Select(x => x.Build()).Select(x => new[] { x }.AsEnumerable())); }
private static State <FilterChainState, XElement> BuildDropShadowFilter(DropShadowFilter filter, CoordinatesConverter converter) { var svgVector = filter.ShadowVector.Pipe(converter.ToSvgVector); var element = XElementBuilder.WithName("feDropShadow").Add( new XAttribute("dx", svgVector.Dx), new XAttribute("dy", svgVector.Dy), new XAttribute("stdDeviation", converter.ScaleDistance(filter.StdDeviation))); return(element.Pipe(BuildIOFilter).Select(x => x.Build())); }
private static State <FilterChainState, IEnumerable <XElement> > BuildDisplacementFilter(DisplacementFilter displacementFilter, CoordinatesConverter converter) { var elementCore = XElementBuilder.WithName("feDisplacementMap") .Add( new XAttribute("scale", converter.ScaleDistance(displacementFilter.Scale)), new XAttribute("xChannelSelector", "R"), new XAttribute("yChannelSelector", "B") ); return(BuildTwoInputFilter(elementCore, displacementFilter.DisplacementProvider, converter)); }