public UGLinearGradientBrush(IUGContext context, Vector2 startPoint, Vector2 endPoint, IEnumerable <UGGradientStop> gradientStops, UGEdgeBehavior edgeBehavior) { var count = gradientStops.Count(); if (count < 2) { throw new ArgumentException(nameof(gradientStops)); } var wpfStops = gradientStops.ToWPFGradientStopCollection(count); var native = new LinearGradientBrush(wpfStops, startPoint.ToWPFPoint(), endPoint.ToWPFPoint()); native.SpreadMethod = edgeBehavior.ToWPFSpreadMethod(); native.Freeze(); _native = native; }
public UGRadialGradientBrush(IUGContext context, Vector2 center, float radius, IEnumerable <UGGradientStop> gradientStops, UGEdgeBehavior edgeBehavior) { var count = gradientStops.Count(); if (count < 2) { throw new ArgumentException(nameof(gradientStops)); } var wpfStops = gradientStops.ToWPFGradientStopCollection(count); var native = new RadialGradientBrush(wpfStops); var wpfCenter = center.ToWPFPoint(); native.Center = wpfCenter; native.GradientOrigin = wpfCenter; native.RadiusX = radius; native.RadiusY = radius; native.SpreadMethod = edgeBehavior.ToWPFSpreadMethod(); native.Freeze(); _native = native; }