/// <summary> /// Constructor for a multi color path gradient fill. /// </summary> /// <param name="pathGradientType">Type of path gradient.</param> /// <param name="gradientColors">A <c>System.Drawing.Drawing2D.ColorBlend</c> object containing arrays of colors and positions defining a multi color gradient.</param> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="gradientColors" /> is null. /// </exception> public BrushPainter(BrushPathGradientType pathGradientType, ColorBlend gradientColors) : this(BrushPainterType.PathGradient, gradientColors.Colors[0], gradientColors.Colors[gradientColors.Colors.Length - 1], HatchStyle.Cross, 0.0f, /* linearGradientAngle */ pathGradientType, gradientColors) { }
// Internal constructor private BrushPainter(BrushPainterType type, Color color1, Color color2, HatchStyle hatchStyle, float linearGradientAngle, BrushPathGradientType pathGradientType, ColorBlend gradientColors) { FillType = type; this.color1 = color1; this.color2 = color2; HatchStyle = hatchStyle; LinearGradientAngle = linearGradientAngle; BrushPathGradientType = pathGradientType; GradientColors = (gradientColors == null) ? Utils.GetDefaultColorBlend() : gradientColors; }
/// <summary> /// Constructor for a multi color path gradient fill. /// </summary> /// <param name="pathGradientType">Type of path gradient.</param> /// <param name="colors">Array of colors to use at corresponding positions along the gradient.</param> /// <param name="positions">Array of positions along the gradient.</param> /// <remarks> /// Refer to the documentation of <c>System.Drawing.Drawing2D.ColorBlend</c> for more information about <c>colors</c> and <c>positions</c>. /// </remarks> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="colors" /> or <paramref name="positions" /> is null. /// </exception> public BrushPainter(BrushPathGradientType pathGradientType, Color[] colors, float[] positions) : this(pathGradientType, Utils.NewColorBlend(colors, positions)) { }
/// <summary> /// Constructor for a two color path gradient fill. /// </summary> /// <param name="pathGradientType">Type of path gradient.</param> /// <param name="startColor">Starting color.</param> /// <param name="endColor">Ending color.</param> public BrushPainter(BrushPathGradientType pathGradientType, Color startColor, Color endColor) : this(pathGradientType, Utils.NewColorBlend(startColor, endColor)) { }