Exemplo n.º 1
0
 public override RadBrush CreateLinearGradientBrush(
     RectangleF rectangle,
     GradientStop[] colorStops,
     RadLinearGradientMode mode)
 {
     return((RadBrush) new GdiLinearGradientBrush(rectangle, colorStops, mode));
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
 public abstract RadBrush CreateLinearGradientBrush(
     RectangleF rectangle,
     GradientStop[] colorStops,
     RadLinearGradientMode mode);