Пример #1
0
        public override C1GradientBrush GetBrush()
        {
            var brush = new C1LinearBrush
            {
                StartPoint = new NSD.Point(gbeBounds.GradientStart.X / 100d, gbeBounds.GradientStart.Y / 100d),
                EndPoint   = new NSD.Point(gbeBounds.GradientEnd.X / 100d, gbeBounds.GradientEnd.Y / 100d)
            };

            return(brush);
        }
Пример #2
0
        private void UpdateBrush()
        {
            _brush = new C1LinearBrush
            {
                StartPoint = new NSD.Point(_gradientStart.X / 100d, _gradientStart.Y / 100d),
                EndPoint   = new NSD.Point(_gradientEnd.X / 100d, _gradientEnd.Y / 100d)
            };

            foreach (var stop in _stops)
            {
                _brush.GradientStops.Add(stop);
            }
        }
Пример #3
0
        private C1LinearBrush ConvertToLinearBrush(C1Brush brush)
        {
            if (brush == null)
            {
                return(new C1LinearBrush());
            }

            var linearBrush = brush as C1LinearBrush;

            if (linearBrush != null)
            {
                return(linearBrush);
            }

            var solidBrush = brush as C1SolidBrush;

            if (solidBrush != null)
            {
                linearBrush = new C1LinearBrush {
                    StartColor = solidBrush.Color, EndColor = solidBrush.Color
                };
                return(linearBrush);
            }

            var radialBrush = brush as C1RadialBrush;

            if (radialBrush != null)
            {
                linearBrush = new C1LinearBrush();
                foreach (var stop in radialBrush.GradientStops)
                {
                    linearBrush.GradientStops.Add(stop);
                }
                return(linearBrush);
            }

            return(new C1LinearBrush());
        }