/// <summary> /// Returns new PathSegment by easing startValue to endValue using a time percentage 0 -> 1. /// </summary> public static PathSegment EaseValue(PathSegment startValue, PathSegment endValue, double percent) { var startType = startValue.GetType(); var endType = endValue.GetType(); if ( startType != endType ) return endValue; // can't ease different types... returning expected end type if ( endValue is LineSegment) return EaseValue((LineSegment)startValue, (LineSegment)endValue, percent); if ( endValue is BezierSegment) return EaseValue((BezierSegment)startValue, (BezierSegment)endValue, percent); if ( endValue is ArcSegment) return EaseValue((ArcSegment)startValue, (ArcSegment)endValue, percent); if ( endValue is PolyLineSegment) return EaseValue((PolyLineSegment)startValue, (PolyLineSegment)endValue, percent); if ( endValue is PolyBezierSegment) return EaseValue((PolyBezierSegment)startValue, (PolyBezierSegment)endValue, percent); if ( endValue is PolyQuadraticBezierSegment) return EaseValue((PolyQuadraticBezierSegment)startValue, (PolyQuadraticBezierSegment)endValue, percent); if ( endValue is QuadraticBezierSegment) return EaseValue((QuadraticBezierSegment)startValue, (QuadraticBezierSegment)endValue, percent); return endValue; }
public static IEnumerable<Telerik.Windows.Documents.Fixed.Model.Graphics.PathSegment> ConvertPathSegments(PathSegment pathSegment) { Type segmentType = pathSegment.GetType(); Func<PathSegment, IEnumerable<Telerik.Windows.Documents.Fixed.Model.Graphics.PathSegment>> converter; if (!segmentConverters.TryGetValue(segmentType, out converter)) { throw new NotSupportedException(String.Format("Not supported PathSegment type: {0}", segmentType)); } return converter(pathSegment); }