public static UGGradientStop[] ToUGGradientStop(this ColorBlend gdiStops) { var count = gdiStops.Colors.Length; var ugStops = new UGGradientStop[count]; for (var i = 0; i < count; ++i) { var color = gdiStops.Colors[i]; var position = gdiStops.Positions[i]; ugStops[i] = new UGGradientStop(color.ToUGColor(), position); } return(ugStops); }
public static UGGradientStop[] ToUGGradientStop(this GradientStopCollection wpfStops) { var count = wpfStops.Count; var ugStops = new UGGradientStop[count]; var i = 0; foreach (var wpfStop in wpfStops) { ugStops[i++] = new UGGradientStop(wpfStop.Color.ToUGColor(), (float)wpfStop.Offset); } return(ugStops); }
private static void AddColorblend(this UGGradientStop ugStop, ref ColorBlend gdiStops, ref int outIdx, float offset) { gdiStops.Colors[outIdx] = ugStop.Color.ToGDIColor(); gdiStops.Positions[outIdx] = offset; ++outIdx; }