private bool ApplyGeometryEffect(IGeometrySourceParameters parameters, bool force) { var flag = false; var cachedGeometry = CachedGeometry; var geometryEffect = parameters.GetGeometryEffect(); if (geometryEffect != null) { if (force) { flag = true; geometryEffect.InvalidateGeometry(InvalidateGeometryReasons.ParentInvalidated); } if (geometryEffect.ProcessGeometry(CachedGeometry)) { flag = true; cachedGeometry = geometryEffect.OutputGeometry; } } if (!Equals(Geometry, cachedGeometry)) { flag = true; Geometry = cachedGeometry; } return(flag); }
public static GeometryEffect GetGeometryEffect(this IGeometrySourceParameters parameters) { if (parameters is DependencyObject obj2) { var geometryEffect = GeometryEffect.GetGeometryEffect(obj2); if (geometryEffect != null && obj2.Equals(geometryEffect.Parent)) { return(geometryEffect); } } return(null); }
public static double GetHalfStrokeThickness(this IGeometrySourceParameters parameter) { if (parameter.Stroke != null) { var strokeThickness = parameter.StrokeThickness; if (!double.IsNaN(strokeThickness) && !double.IsInfinity(strokeThickness)) { return(Math.Abs(strokeThickness) / 2.0); } } return(0.0); }
public bool UpdateGeometry(IGeometrySourceParameters parameters, Rect layoutBounds) { var force = false; if (parameters is TParameters parameters1) { var rect = ComputeLogicalBounds(layoutBounds, parameters1); force |= LayoutBounds != layoutBounds || LogicalBounds != rect; if (_geometryInvalidated || force) { LayoutBounds = layoutBounds; LogicalBounds = rect; force |= UpdateCachedGeometry(parameters1); force |= ApplyGeometryEffect(parameters1, force); } } _geometryInvalidated = false; return(force); }
protected override Rect ComputeLogicalBounds(Rect layoutBounds, IGeometrySourceParameters parameters) { return(GeometryHelper.GetStretchBound(base.ComputeLogicalBounds(layoutBounds, parameters), parameters.Stretch, new Size(1.0, 1.0))); }
protected virtual Rect ComputeLogicalBounds(Rect layoutBounds, IGeometrySourceParameters parameters) { return(GeometryHelper.Inflate(layoutBounds, -parameters.GetHalfStrokeThickness())); }