public override void Render(WpfDrawingRenderer renderer) { if (_drawGroup != null) { Geometry clipGeom = this.ClipGeometry; if (clipGeom != null) { _drawGroup.ClipGeometry = clipGeom; } Transform transform = this.Transform; if (transform != null) { _drawGroup.Transform = transform; } float opacityValue = -1; SvgGElement element = (SvgGElement)_svgElement; string opacity = element.GetAttribute("opacity"); if (string.IsNullOrWhiteSpace(opacity)) { opacity = element.GetPropertyValue("opacity"); } if (!string.IsNullOrWhiteSpace(opacity)) { opacityValue = (float)SvgNumber.ParseNumber(opacity); opacityValue = Math.Min(opacityValue, 1); opacityValue = Math.Max(opacityValue, 0); } if (opacityValue >= 0 && opacityValue < 1) { _drawGroup.Opacity = opacityValue; } string sVisibility = element.GetPropertyValue("visibility"); string sDisplay = element.GetPropertyValue("display"); if (string.Equals(sVisibility, "hidden") || string.Equals(sDisplay, "none")) { _drawGroup.Opacity = 0; } } // Register this drawing with the Drawing-Document... this.Rendered(_drawGroup); base.Render(renderer); }
public override void Render(WpfDrawingRenderer renderer) { if (_drawGroup != null) { Geometry clipGeom = this.ClipGeometry; if (clipGeom != null) { _drawGroup.ClipGeometry = clipGeom; } Transform transform = this.Transform; if (transform != null) { _drawGroup.Transform = transform; } float opacityValue = -1; SvgGElement element = (SvgGElement)_svgElement; string opacity = element.GetAttribute("opacity"); if (string.IsNullOrWhiteSpace(opacity)) { opacity = element.GetPropertyValue("opacity"); } if (!string.IsNullOrWhiteSpace(opacity)) { opacityValue = (float)SvgNumber.ParseNumber(opacity); opacityValue = Math.Min(opacityValue, 1); opacityValue = Math.Max(opacityValue, 0); } if (opacityValue >= 0 && opacityValue < 1) { _drawGroup.Opacity = opacityValue; } string sVisibility = element.GetPropertyValue("visibility"); string sDisplay = element.GetPropertyValue("display"); if (string.Equals(sVisibility, "hidden", StringComparison.OrdinalIgnoreCase)) { var isOverriden = false; foreach (XmlNode child in element.ChildNodes) { if (child.NodeType == XmlNodeType.Element) { var svgElem = child as SvgElement; if (svgElem != null && string.Equals(svgElem.GetAttribute("visibility"), "visible", StringComparison.OrdinalIgnoreCase)) { isOverriden = true; break; } } } if (!isOverriden) { _drawGroup.Opacity = 0; } } else if (string.Equals(sDisplay, "none", StringComparison.OrdinalIgnoreCase)) { _drawGroup.Opacity = 0; } } // Register this drawing with the Drawing-Document... this.Rendered(_drawGroup); base.Render(renderer); }