public override RadBrush CreateLinearGradientBrush( RectangleF rectangle, GradientStop[] colorStops, RadLinearGradientMode mode) { return((RadBrush) new GdiLinearGradientBrush(rectangle, colorStops, mode)); }
public GdiLinearGradientBrush(RectangleF rectangle, GradientStop[] gradientStops, float angle) { this.angle = angle; this.mode = RadLinearGradientMode.None; this.gradientStops = gradientStops; rectangle.Width = Math.Max(1f, rectangle.Width); rectangle.Height = Math.Max(1f, rectangle.Height); this.rawBrush = new LinearGradientBrush(rectangle, Color.Black, Color.Black, angle); this.rawBrush.WrapMode = WrapMode.TileFlipXY; this.rawBrush.InterpolationColors = GdiUtility.GetColorBlend(gradientStops); }
public GdiLinearGradientBrush( RectangleF rectangle, GradientStop[] gradientStops, RadLinearGradientMode mode) { if (mode == RadLinearGradientMode.None) { throw new NotSupportedException("The brush cannot be initialized with " + (object)mode); } this.mode = mode; this.angle = 0.0f; this.gradientStops = gradientStops; rectangle.Width = Math.Max(1f, rectangle.Width); rectangle.Height = Math.Max(1f, rectangle.Height); this.rawBrush = new LinearGradientBrush(rectangle, Color.Black, Color.Black, (LinearGradientMode)this.mode); LinearGradientBrush rawBrush = this.rawBrush; GradientStop[] gradientStops1; if (gradientStops.Length == 1) { gradientStops1 = new GradientStop[2] { new GradientStop(gradientStops[0].Color, 0.0f), new GradientStop(gradientStops[0].Color, 1f) } } ; else { gradientStops1 = gradientStops; } ColorBlend colorBlend = GdiUtility.GetColorBlend(gradientStops1); rawBrush.InterpolationColors = colorBlend; this.rawBrush.WrapMode = WrapMode.TileFlipXY; }
public abstract RadBrush CreateLinearGradientBrush( RectangleF rectangle, GradientStop[] colorStops, RadLinearGradientMode mode);