public override void BeforeRender(WpfDrawingRenderer renderer) { base.BeforeRender(renderer); _isAggregated = false; if (_svgElement.FirstChild == _svgElement.LastChild) { SvgGElement gElement = _svgElement.FirstChild as SvgGElement; if (gElement != null) { string elementId = gElement.GetAttribute("id"); if (!string.IsNullOrWhiteSpace(elementId) && string.Equals(elementId, "IndicateLayer", StringComparison.OrdinalIgnoreCase)) { WpfDrawingContext context = renderer.Context; DrawingGroup animationGroup = context.Links; if (animationGroup != null) { context.Push(animationGroup); } _isLayer = true; } } } }
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 (opacity != null && opacity.Length > 0) { opacityValue = (float)SvgNumber.ParseNumber(opacity); opacityValue = Math.Min(opacityValue, 1); opacityValue = Math.Max(opacityValue, 0); } if (opacityValue >= 0) { _drawGroup.Opacity = opacityValue; } } 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") || 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); }