private void SetGradientStops() { RenderGradientStop[] gradientStops = GradientStops.ToArray(); HtmlElement htmlElement = HtmlElement; while (htmlElement.Children.Count > gradientStops.Length) { htmlElement.RemoveChild(htmlElement.LastElementChild); } while (htmlElement.Children.Count < gradientStops.Length) { htmlElement.AppendChild(SvgDocument.CreateElement("stop")); } for (int i = 0; i < gradientStops.Length; i++) { HtmlElement stopElement = htmlElement.Children[i]; stopElement.SetAttribute("stop-color", converter.ToColorString(gradientStops[i].Color)); stopElement.SetAttribute("stop-opacity", converter.ToImplicitValueString(Opacity * gradientStops[i].Color.A / 255)); stopElement.SetAttribute("offset", converter.ToImplicitValueString(gradientStops[i].Offset)); } }
private void SetStop() { stopElement.SetAttribute("stop-color", converter.ToColorString(Color)); stopElement.SetAttribute("stop-opacity", converter.ToImplicitValueString(Opacity * Color.A / 255)); }