コード例 #1
1
ファイル: Button.cs プロジェクト: jonathandlo/deep-space-dive
        public Button(string pText, float pX, float pY, float pWidth, float pHeight, bool pSmall)
        {
            width = pWidth;
            height = pHeight;
            x = pX;
            y = pY;

            // Text properties
            var brushProp = new LinearGradientBrushProperties();
            brushProp.StartPoint = new Vector2(x, y);
            brushProp.EndPoint = new Vector2(x, y + height);

            var stops = new GradientStop[2];
            stops[0] = new GradientStop() { Color = new Color4(1, 1, 1, 0.5f), Position = 0 };
            stops[1] = new GradientStop() { Color = new Color4(1, 1, 1, 1.0f), Position = 1 };

            textBrush = new LinearGradientBrush(GraphicsWindow.Instance.RenderTarget2D, brushProp, new GradientStopCollection(GraphicsWindow.Instance.RenderTarget2D, stops));
            textLayout = new TextLayout(Factories.FactoryWrite, pText, pSmall? Constants.SmallFont : Constants.RegularFont, width, height);

            // Frame properties
            borderBrush = new SolidColorBrush(GraphicsWindow.Instance.RenderTarget2D, new Color4(0, 0, 0, 0.3f));
            backBrush = new SolidColorBrush(GraphicsWindow.Instance.RenderTarget2D, new Color4(0.1f, 0.3f, 0.4f, 0.5f));
            highlightBrush = new SolidColorBrush(GraphicsWindow.Instance.RenderTarget2D, new Color4(0.2f, 0.6f, 0.8f, 0.5f));
            highlight = false;
        }
コード例 #2
0
		protected static List<GradientStop> EnsureMinDiffBetweenPoints(List<GradientStop> stops)
		{
			stops = stops.OrderBy(w => w.Offset).ToList();

			var newList = new List<GradientStop>();
			newList.Add(stops[0]);

			var lower = stops[0];
			for (int i = 1; i < stops.Count; i++)
			{
				var higher = stops[i];

				if ((higher.Offset - lower.Offset) < minDiffBetweenStops)
				{
					var replacement = new GradientStop() { Offset = Math.Max(higher.Offset, lower.Offset) + minDiffBetweenStops, Color = higher.Color };

					newList.Add(replacement);
					lower = replacement;
				}
				else
				{
					newList.Add(higher);
					lower = higher;
				}
			}

			return newList;
		}
コード例 #3
0
        private RadialGradientBrush CreateRadialGradientBrush(DeviceContext context, float width, float height, Color4 color1, Color4 color2, float color1Position, float color2Position)
        {

            GradientStop[] stops = new GradientStop[2];
            //stops[0] = new GradientStop() { Color = new Color4(0.85f, 0, 0, 1.0f), Position = 0.0f };
            //stops[1] = new GradientStop() { Color = new Color4(0.22f, 0, 0, 1.0f), Position = 1.0f };
            stops[0] = new GradientStop() { Color = color1, Position = color1Position };
            stops[1] = new GradientStop() { Color = color2, Position = color2Position };


            GradientStopCollection gsc = new GradientStopCollection(context, stops, ExtendMode.Clamp);

            RadialGradientBrush brush = new RadialGradientBrush(
                context,
                new RadialGradientBrushProperties()
                {
                    RadiusX = width / 1.3f,
                    RadiusY = height / 1.3f,
                    Center = new Vector2(width / 2.0f, height / 2.0f),
                    GradientOriginOffset = new Vector2(0, 0)
                },
                gsc);


            return brush;
        }
コード例 #4
0
ファイル: RadialShader.cs プロジェクト: yong-ja/starodyssey
        public static Color4[] RadialManual(GradientStop[] gradient, int numVertex, int offsetIndex)
        {
            Color4[] colors = new Color4[numVertex];
            for (int i = 0; i < numVertex; i++)
                colors[i] = gradient[offsetIndex].Color;

            return colors;
        }
コード例 #5
0
        /// <summary>
        /// Generates the color gradient that will fill individual squares
        /// </summary>
        /// <param name="_color"></param>
        /// <returns></returns>
        private Brush SetGradientColor(Color _color)
        {
            LinearGradientBrush GradientColor = new LinearGradientBrush();

            GradientColor.StartPoint = new Point(0, 0);
            GradientColor.EndPoint   = new Point(1, 1.5);
            GradientStop Black = new GradientStop();

            Black.Color  = Colors.Black;
            Black.Offset = -1.5;
            GradientColor.GradientStops.Add(Black);
            GradientStop Other = new GradientStop();

            Other.Color = _color;
            GradientColor.GradientStops.Add(Other);
            return(GradientColor);
        }
コード例 #6
0
        public static void FadeHorz(this System.Windows.Shapes.Rectangle self, Color color1, Color color2)
        {
            LinearGradientBrush gr = new LinearGradientBrush {
                EndPoint = new Point(1, 0.5), StartPoint = new Point(0, 0.5)
            };
            GradientStop grStop1 = new GradientStop {
                Color = color1, Offset = 0
            };

            gr.GradientStops.Add(grStop1);
            GradientStop grStop2 = new GradientStop {
                Color = color2, Offset = 1
            };

            gr.GradientStops.Add(grStop2);
            self.Fill = gr;
        }
コード例 #7
0
        public NaiveGradientButton()
        {
            LinearGradientBrush brush = new LinearGradientBrush();

            brush.StartPoint = new Point(0, 0);
            brush.EndPoint   = new Point(1, 0);

            gradientStop1        = new GradientStop();
            gradientStop1.Offset = 0;
            brush.GradientStops.Add(gradientStop1);

            gradientStop2        = new GradientStop();
            gradientStop2.Offset = 1;
            brush.GradientStops.Add(gradientStop2);

            Foreground = brush;
        }
コード例 #8
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Brush      brush1 = (Brush)null;
            ColorModel source = value as ColorModel;

            if (source != null)
            {
                ColorModel model = new ColorModel(source);
                model.ScA = 1f;
                this.UpdateModelForGradientMin(model);
                GradientStop gradientStop1 = new GradientStop(model.Color, 0.0);
                gradientStop1.Freeze();
                this.UpdateModelForGradientMax(model);
                GradientStop gradientStop2 = new GradientStop(model.Color, 1.0);
                gradientStop2.Freeze();
                GradientStopCollection gradientStopCollection = new GradientStopCollection(2);
                gradientStopCollection.Add(gradientStop1);
                gradientStopCollection.Add(gradientStop2);
                gradientStopCollection.Freeze();
                LinearGradientBrush linearGradientBrush = new LinearGradientBrush();
                linearGradientBrush.StartPoint    = new Point(0.0, 0.0);
                linearGradientBrush.EndPoint      = new Point(1.0, 0.0);
                linearGradientBrush.GradientStops = gradientStopCollection;
                linearGradientBrush.Freeze();
                brush1 = (Brush)linearGradientBrush;
                Brush brush2 = parameter as Brush;
                if (brush2 != null)
                {
                    brush2.Freeze();
                    RectangleGeometry rectangleGeometry = new RectangleGeometry(new Rect(0.0, 0.0, 100.0, 10.0));
                    rectangleGeometry.Freeze();
                    GeometryDrawing geometryDrawing1 = new GeometryDrawing(brush2, (Pen)null, (Geometry)rectangleGeometry);
                    brush2.Freeze();
                    GeometryDrawing geometryDrawing2 = new GeometryDrawing(brush1, (Pen)null, (Geometry)rectangleGeometry);
                    geometryDrawing2.Freeze();
                    DrawingGroup drawingGroup = new DrawingGroup();
                    drawingGroup.Children.Add((Drawing)geometryDrawing1);
                    drawingGroup.Children.Add((Drawing)geometryDrawing2);
                    drawingGroup.Freeze();
                    DrawingBrush drawingBrush = new DrawingBrush((Drawing)drawingGroup);
                    drawingBrush.Freeze();
                    brush1 = (Brush)drawingBrush;
                }
            }
            return((object)brush1);
        }
コード例 #9
0
            private void OnRemoveButtonClicked()
            {
                var values = (object[])Values.Clone();
                var index  = _stops.IndexOf(_selected);

                _selected = null;

                var count = (int)values[0];

                if (count > 0)
                {
                    Array.Copy(values, 1 + index * 2 + 2, values, 1 + index * 2, (count - index - 1) * 2);
                }
                values[0] = count - 1;

                SetValues(values);
            }
        protected override LinearGradientBrush GetCurrentValueCore(LinearGradientBrush
                                                                   defaultOriginValue, LinearGradientBrush defaultDestinationValue,
                                                                   AnimationClock animationClock)
        {
            // check for length of from and to
            if (From.GradientStops.Count != To.GradientStops.Count)
            {
                return(From);
            }

            if (animationClock.CurrentProgress == null)
            {
                return(From);
            }

            LinearGradientBrush brush = new LinearGradientBrush();

            brush.StartPoint = From.StartPoint + ((To.StartPoint - From.StartPoint) *
                                                  (double)animationClock.CurrentProgress);
            brush.EndPoint = From.EndPoint + ((To.EndPoint - From.EndPoint) *
                                              (double)animationClock.CurrentProgress);

            // calc gradientstops
            for (int cnt = 0; cnt < From.GradientStops.Count; cnt++)
            {
                GradientStop stop1 = From.GradientStops[cnt];
                GradientStop stop2 = To.GradientStops[cnt];

                // calc color
                Color color1   = stop1.Color;
                Color color2   = stop2.Color;
                Color newColor = Color.Subtract(color2, color1);
                newColor = Color.Multiply(newColor,
                                          (float)animationClock.CurrentProgress);
                newColor = Color.Add(newColor, color1);

                // calc offset
                double offset1 = (double)stop1.Offset;
                double offset2 = (double)stop2.Offset;
                double offset  = offset1 + ((offset2 - offset1) *
                                            (double)animationClock.CurrentProgress);

                brush.GradientStops.Add(new GradientStop(newColor, offset));
            }
            return(brush);
        }
コード例 #11
0
        private void SetBackground()
        {
            var brush = new LinearGradientBrush {
                StartPoint = new Point(0.5, 0.0),
                EndPoint   = new Point(0.5, 1.0)
            };
            var spectrumColors = ColorUtils.GetSpectrumColors(30);

            for (var i = 0; i < 30; i++)
            {
                var offset = (i * 1.0) / 30.0;
                var stop   = new GradientStop(spectrumColors[i], offset);
                brush.GradientStops.Add(stop);
            }

            Background = brush;
        }
コード例 #12
0
        public void Initialize(PhysicsSimulator physicsSimulator)
        {
            int count = WaterModel.WaveController.NodeCount;

            _points = new PointCollection(); //[count + 2];
            for (int i = 0; i < count; i++)
            {
                _points.Add(new Point(ConvertUnits.ToDisplayUnits(WaterModel.WaveController.XPosition[i]),
                                      ConvertUnits.ToDisplayUnits(WaterModel.WaveController.CurrentWave[i])));
            }

            _bottomRightPoint = new Point(ConvertUnits.ToDisplayUnits(WaterModel.WaveController.XPosition[count - 1]),
                                          ConvertUnits.ToDisplayUnits(WaterModel.WaveController.Position.Y) +
                                          ConvertUnits.ToDisplayUnits(WaterModel.WaveController.Height));
            _bottomLeftPoint = new Point(ConvertUnits.ToDisplayUnits(WaterModel.WaveController.XPosition[0]),
                                         ConvertUnits.ToDisplayUnits(WaterModel.WaveController.Position.Y) +
                                         ConvertUnits.ToDisplayUnits(WaterModel.WaveController.Height));
            _points.Add(_bottomRightPoint);
            _points.Add(_bottomLeftPoint);

            _wavePolygon = ShapeFactory.CreatePolygon(_points, null, null, null);
            _wavePolygon.IsHitTestVisible = false;
            _wavePolygon.Opacity          = _opacity;
            _canvas.Children.Add(_wavePolygon);

            _waveBrush            = new LinearGradientBrush();
            _waveBrush.EndPoint   = new Point(.5f, .5f);
            _waveBrush.StartPoint = new Point(.5f, 0f);

            GradientStop gradientTop = new GradientStop();

            gradientTop.Color  = _gradientTopColor;
            gradientTop.Offset = 0;

            GradientStop gradientBottom = new GradientStop();

            gradientBottom.Color  = _gradientBottomColor;
            gradientBottom.Offset = 1;

            _waveBrush.GradientStops.Add(gradientTop);
            _waveBrush.GradientStops.Add(gradientBottom);

            _wavePolygon.Fill            = _waveBrush;
            _wavePolygon.Stroke          = new SolidColorBrush(Color.FromArgb(200, 0, 0, 0));
            _wavePolygon.StrokeThickness = 1f;
        }
コード例 #13
0
ファイル: Utils.cs プロジェクト: traderdata/COMPONENTES
        public static LinearGradientBrush CreateFadeHorzBrush(Color color1, Color color2)
        {
            LinearGradientBrush gr = new LinearGradientBrush {
                EndPoint = new Point(1, 0.5), StartPoint = new Point(0, 0.5)
            };
            GradientStop grStop1 = new GradientStop {
                Color = color1, Offset = 0
            };

            gr.GradientStops.Add(grStop1);
            GradientStop grStop2 = new GradientStop {
                Color = color2, Offset = 1
            };

            gr.GradientStops.Add(grStop2);
            return(gr);
        }
コード例 #14
0
    internal static LinearGradientBrush AddLinearGradientBrush(LinearGradientBrush brush1, LinearGradientBrush brush2)
    {
        LinearGradientBrush gradientBrush = new LinearGradientBrush();

        gradientBrush.StartPoint = AddPoint(brush1.StartPoint, brush2.StartPoint);
        gradientBrush.EndPoint   = AddPoint(brush1.EndPoint, brush2.EndPoint);
        for (int i = 0; i < brush1.GradientStops.Count; i++)
        {
            GradientStop gradientStop1 = brush1.GradientStops[i];
            GradientStop gradientStop2 = brush2.GradientStops[i];

            Color  color  = AddColor(gradientStop1.Color, gradientStop2.Color);
            double offset = AddDouble(gradientStop1.Offset, gradientStop2.Offset);
            gradientBrush.GradientStops.Add(new GradientStop(color, offset));
        }
        return(gradientBrush);
    }
コード例 #15
0
        /// <summary>
        /// Creates a 'stepped' gradient brush from a list of colors.
        /// </summary>
        /// <param name="colors">The colors.</param>
        /// <param name="horizontal">if set to <c>true</c> [horizontal].</param>
        /// <returns>A gradientbrush.</returns>
        public static LinearGradientBrush CreateSteppedGradientBrush(IList <Color> colors, bool horizontal = true)
        {
            var brush = new LinearGradientBrush {
                StartPoint = new Point(0, 0), EndPoint = horizontal ? new Point(1, 0) : new Point(0, 1)
            };
            int n = colors.Count;

            for (int i = 0; i < n; i++)
            {
                var gs0 = new GradientStop(colors[i], (double)i / n);
                var gs1 = new GradientStop(colors[i], (double)(i + 1) / n);
                brush.GradientStops.Add(gs0);
                brush.GradientStops.Add(gs1);
            }

            return(brush);
        }
コード例 #16
0
        public override IEnumerable <Tuple <object, object> > GetResourceKeyValues(ThemeColor hlColor)
        {
            var br = new LinearGradientBrush()
            {
                StartPoint = StartPoint,
                EndPoint   = EndPoint,
            };

            for (int i = 0; i < GradientOffsets.Length; i++)
            {
                var gs = new GradientStop(((SolidColorBrush)hlColor.GetBrushByIndex(i)).Color, GradientOffsets[i]);
                gs.Freeze();
                br.GradientStops.Add(gs);
            }
            br.Freeze();
            yield return(new Tuple <object, object>(ResourceKey, br));
        }
コード例 #17
0
        public TempBtnInfoEx()
        {
            LinearGradientBrush brush = new LinearGradientBrush();

            GradientStop gs1 = new GradientStop();

            gs1.Offset = 0;
            gs1.Color  = (Color)ColorConverter.ConvertFromString("#FF377FED");
            brush.GradientStops.Add(gs1);

            GradientStop gs2 = new GradientStop();

            gs2.Offset = 1;
            gs2.Color  = (Color)ColorConverter.ConvertFromString("#FF074CC0");
            brush.GradientStops.Add(gs2);
            BtnColor = brush;
        }
コード例 #18
0
        private void RemoveStopButton_Click(object sender, RoutedEventArgs e)
        {
            GradientStop stop = (sender as Button).Tag as GradientStop;

            if (PickedBrush == this.LinearGradientBrush)
            {
                this.LinearGradientBrush.GradientStops.Remove(stop);
                xamlLinearGradientStops.SelectedIndex = -1;
                xamlLinearGradientStops.Items.Refresh();
            }
            else if (PickedBrush == this.RadialGradientBrush)
            {
                this.RadialGradientBrush.GradientStops.Remove(stop);
                xamlRadialGradientStops.SelectedIndex = -1;
                xamlRadialGradientStops.Items.Refresh();
            }
        }
コード例 #19
0
        static public LinearGradientBrush Get2LinearGradientBrushFromSolidBrush(SolidColorBrush BlockColor)
        {
            LinearGradientBrush Brush = new LinearGradientBrush();

            Brush.StartPoint = new Point(0.2, 0);
            Brush.EndPoint   = new Point(0.8, 1);
            GradientStop item1 = new GradientStop(), item2 = new GradientStop();

            item1.Offset = 1; item1.Color = BlockColor.Color;
            item2.Offset = 0; item2.Color = Colors.White;
            GradientStopCollection t = new GradientStopCollection();

            t.Add(item1);
            t.Add(item2);
            Brush.GradientStops = t;
            return(Brush);
        }
コード例 #20
0
        /// <summary>
        /// Create a Theme background LinearGradientBrush.
        /// </summary>
        /// <param name="startColor">
        /// Represents the start color of the gradient.
        /// </param>
        /// <param name="endColor">
        /// Represents the end color of the gradient.
        /// </param>
        /// <returns>Returns a linear gradient brush.</returns>
        private static LinearGradientBrush GetLinearBrush(Color startColor, Color endColor)
        {
            LinearGradientBrush brush      = new LinearGradientBrush();
            GradientStop        colorStop1 = new GradientStop();

            colorStop1.Color = startColor;
            GradientStop colorStop2 = new GradientStop();

            colorStop2.Color    = endColor;
            colorStop2.Offset   = 1;
            brush.StartPoint    = new System.Windows.Point(0.5, 1);
            brush.EndPoint      = new System.Windows.Point(0.5, 0);
            brush.GradientStops = new GradientStopCollection {
                colorStop1, colorStop2
            };
            return(brush);
        }
コード例 #21
0
        /// <summary>
        /// Sets the <see cref="ColorStop.IsSelected"/> properties of the <see cref="ColorStop"/>
        /// controls.
        /// </summary>
        /// <remarks>The selection is determined by _selectedIndex.</remarks>
        private void SetSelection()
        {
            if (_colorStopPanel == null || GradientStops == null)
            {
                return;
            }

            foreach (var child in _colorStopPanel.Children)
            {
                ColorStop control = child as ColorStop;
                if (control != null)
                {
                    GradientStop gradientStop = (GradientStop)control.Tag;
                    control.IsSelected = (_selectedIndex == GradientStops.IndexOf(gradientStop));
                }
            }
        }
コード例 #22
0
ファイル: MeasureTool.cs プロジェクト: configare/hispeed
        private Brush GetBackground()
        {
            LinearGradientBrush brush = new LinearGradientBrush();

            brush.StartPoint = new Point(0, 0);
            brush.EndPoint   = new Point(1, 0);
            GradientStop stop = new GradientStop();

            stop.Color  = Color.FromArgb(156, 204, 220, 241);
            stop.Offset = 0;
            brush.GradientStops.Add(stop);
            stop       = new GradientStop();
            stop.Color = Color.FromArgb(156, 8, 138, 254);
            brush.GradientStops.Add(stop);
            stop.Offset = 1;
            return(brush);
        }
コード例 #23
0
ファイル: ModelWall.cs プロジェクト: uwitec/gloryview-rfid
        public DiffuseMaterial setmaterial1()
        {
            DiffuseMaterial material = new DiffuseMaterial();
            DrawingBrush    brush    = new DrawingBrush();

            brush.Viewport = new Rect(0, 0, 0.36, 0.2);
            brush.TileMode = TileMode.Tile;
            DrawingGroup    Dgroup = new DrawingGroup();
            GeometryDrawing draw1  = new GeometryDrawing();

            draw1.Brush = Brushes.Silver;
            RectangleGeometry RectGeometry1 = new RectangleGeometry();

            RectGeometry1.Rect = new Rect(0, 0, 100, 100);
            draw1.Geometry     = RectGeometry1;
            GeometryDrawing   draw2         = new GeometryDrawing();
            GeometryGroup     Ggroup        = new GeometryGroup();
            RectangleGeometry RectGeometry2 = new RectangleGeometry();

            RectGeometry2.Rect = new Rect(0, 0, 50, 50);
            RectangleGeometry RectGeometry3 = new RectangleGeometry();

            RectGeometry3.Rect = new Rect(50, 50, 50, 50);
            Ggroup.Children.Add(RectGeometry2);
            Ggroup.Children.Add(RectGeometry3);
            draw2.Geometry = Ggroup;
            draw2.Brush    = Brushes.White;
            LinearGradientBrush linebrush = new LinearGradientBrush();
            GradientStop        dient1    = new GradientStop();

            dient1.Offset = 0.0;
            dient1.Color  = Colors.White;
            GradientStop dient2 = new GradientStop();

            dient2.Offset = 1.0;
            dient2.Color  = Colors.LightCyan;
            linebrush.GradientStops.Add(dient1);
            linebrush.GradientStops.Add(dient2);
            draw2.Brush = linebrush;
            Dgroup.Children.Add(draw1);
            Dgroup.Children.Add(draw2);
            brush.Drawing  = Dgroup;
            material.Brush = brush;
            return(material);
        }
コード例 #24
0
        /// <summary> 新しいグラデーションブラシを生成します。
        /// </summary>
        protected void CalculateNewGradient()
        {
            var brush = new LinearGradientBrush();

            brush.StartPoint = new Point(1.0, 0.5);
            brush.EndPoint   = new Point(0.0, 0.5);

            double progress = base.Maximum - base.Value;

            if (progress <= 0)
            {
                if (this.AutoHide)
                {
                    base.Visibility = this.HideType;
                    return;
                }
            }
            else if (progress < this.GradientStop2StartValue)
            {
                var newGradientStop2 = new GradientStop(this.GradientColor3, this.GradientStop2EndValue - progress);
                var newGradientStop1 = new GradientStop(this.GradientColor2, this.GradientStop2StartValue - progress);
                brush.GradientStops.Add(newGradientStop2);
                brush.GradientStops.Add(newGradientStop1);
            }
            else if (progress < this.GradientStop1StartValue)
            {
                var newGradientStop2 = new GradientStop(this.GradientColor2, this.GradientStop1EndValue - progress);
                var newGradientStop1 = new GradientStop(this.GradientColor1, this.GradientStop1StartValue - progress);
                brush.GradientStops.Add(newGradientStop2);
                brush.GradientStops.Add(newGradientStop1);
            }
            else
            {
                var newGradientStop = new GradientStop(this.GradientColor1, 0);
                brush.GradientStops.Add(newGradientStop);
            }


            if (this.AutoHide)
            {
                base.Visibility = Visibility.Visible;
            }

            base.Foreground = brush;
        }
コード例 #25
0
        private static void OnGradualInChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var element = d as FrameworkElement;

            var collection = new GradientStopCollection();

            var stop1 = new GradientStop()
            {
                Offset = 0, Color = Colors.White
            };
            var stop2 = new GradientStop()
            {
                Offset = 0, Color = Colors.Transparent
            };

            collection.Add(stop1);
            collection.Add(stop2);

            var brush = new LinearGradientBrush()
            {
                StartPoint    = new Point(0, 0),
                EndPoint      = new Point(0, 1),
                GradientStops = collection,
            };

            element.OpacityMask = brush;

            if (element.IsLoaded)
            {
                var duration     = GetDurationSeconds(element);
                var beginSeconds = GetBeginTimeSeconds(element);
                stop2.BeginAnimation(GradientStop.OffsetProperty, GetDoubleAnimation(1, TimeSpan.FromSeconds(duration), TimeSpan.FromSeconds(beginSeconds)));
                stop2.BeginAnimation(GradientStop.ColorProperty, GetColorAnimation(Colors.White, TimeSpan.FromSeconds(duration / 0.5), TimeSpan.FromSeconds(duration * 0.75)));
            }
            else
            {
                element.Loaded += delegate
                {
                    var duration     = GetDurationSeconds(element);
                    var beginSeconds = GetBeginTimeSeconds(element);
                    stop2.BeginAnimation(GradientStop.OffsetProperty, GetDoubleAnimation(1, TimeSpan.FromSeconds(duration), TimeSpan.FromSeconds(beginSeconds)));
                    stop2.BeginAnimation(GradientStop.ColorProperty, GetColorAnimation(Colors.White, TimeSpan.FromSeconds(duration / 0.5), TimeSpan.FromSeconds(duration * 0.75)));
                };
            }
        }
コード例 #26
0
        private Rectangle ComposeRectangleBarFromEmotions(EmotionScores emotionScores)
        {
            var emotionRankedList       = emotionScores.ToRankedList();
            var gradientStopsCollection = new GradientStopCollection();
            var occuringEmotions        = emotionRankedList.Reverse().Where(emotion => emotion.Value > 0.0).ToList();
            var occuringEmotionsCount   = occuringEmotions.Count;
            var previousValue           = 0.0f;

            for (var i = 0; i < occuringEmotionsCount; i++)
            {
                var emotion      = occuringEmotions[i];
                var emotionColor = GetEmotionColor(emotion.Key);
                var emotionValue = emotion.Value;

                if (i == 0 || i == occuringEmotionsCount - 1)
                {
                    if (i == 0)
                    {
                        previousValue = emotionValue;
                    }
                    var gradientStop = new GradientStop(emotionColor, previousValue);
                    gradientStopsCollection.Add(gradientStop);
                }
                else
                {
                    var gradientStopStartPoint = new GradientStop(emotionColor, previousValue);
                    gradientStopsCollection.Add(gradientStopStartPoint);
                    previousValue += emotionValue;
                    var gradientStopEndPoint = new GradientStop(emotionColor, previousValue);
                    gradientStopsCollection.Add(gradientStopEndPoint);
                }
            }

            var linearGradientBrush =
                new LinearGradientBrush(gradientStopsCollection, new Point(0.0, 0.0), new Point(0.0, 1.0));
            var composedBar = new Rectangle
            {
                Fill   = linearGradientBrush,
                Width  = 5.0,
                Margin = new Thickness(1.0, 0, 1.0, 0)
            };
            var result = composedBar;

            return(result);
        }
コード例 #27
0
ファイル: Window1.xaml.cs プロジェクト: kagada/Arianrhod
        /// <summary>
        /// This method creates the render target and all associated D2D and DWrite resources
        /// </summary>
        void CreateDeviceResources()
        {
            // Only calls if resources have not been initialize before
            if (renderTarget == null)
            {
                // The text format
                textFormat = dwriteFactory.CreateTextFormat("Bodoni MT", 24, DWrite.FontWeight.Normal, DWrite.FontStyle.Italic, DWrite.FontStretch.Normal);

                // Create the render target
                SizeU size = new SizeU((uint)host.ActualWidth, (uint)host.ActualHeight);
                RenderTargetProperties     props     = new RenderTargetProperties();
                HwndRenderTargetProperties hwndProps = new HwndRenderTargetProperties(host.Handle, size, PresentOptions.None);
                renderTarget = d2dFactory.CreateHwndRenderTarget(props, hwndProps);

                // A black brush to be used for drawing text
                ColorF cf = new ColorF(0, 0, 0, 1);
                blackBrush = renderTarget.CreateSolidColorBrush(cf);

                // Create a linear gradient.
                GradientStop[] stops =
                {
                    new GradientStop(1, new ColorF(1f, 0f, 0f, 0.25f)),
                    new GradientStop(0, new ColorF(0f, 0f, 1f, 1f))
                };

                GradientStopCollection        pGradientStops = renderTarget.CreateGradientStopCollection(stops, Gamma.Linear, ExtendMode.Wrap);
                LinearGradientBrushProperties gradBrushProps = new LinearGradientBrushProperties(new Point2F(50, 25), new Point2F(25, 50));

                linearGradientBrush = renderTarget.CreateLinearGradientBrush(gradBrushProps, pGradientStops);

                gridPatternBitmapBrush = CreateGridPatternBrush(renderTarget);

                solidBrush1 = renderTarget.CreateSolidColorBrush(new ColorF(0.3F, 0.5F, 0.65F, 0.25F));
                solidBrush2 = renderTarget.CreateSolidColorBrush(new ColorF(0.0F, 0.0F, 0.65F, 0.5F));
                solidBrush3 = renderTarget.CreateSolidColorBrush(new ColorF(0.9F, 0.5F, 0.3F, 0.75F));

                // Create a linear gradient.
                stops[0] = new GradientStop(1, new ColorF(0f, 0f, 0f, 0.25f));
                stops[1] = new GradientStop(0, new ColorF(1f, 1f, 0.2f, 1f));
                GradientStopCollection radiantGradientStops = renderTarget.CreateGradientStopCollection(stops, Gamma.Linear, ExtendMode.Wrap);

                RadialGradientBrushProperties radialBrushProps = new RadialGradientBrushProperties(new Point2F(25, 25), new Point2F(0, 0), 10, 10);
                radialGradientBrush = renderTarget.CreateRadialGradientBrush(radialBrushProps, radiantGradientStops);
            }
        }
コード例 #28
0
        private LinearGradientBrush GetContentBackgroundBrush(int index)
        {
            LinearGradientBrush lbrush = new LinearGradientBrush();

            lbrush.StartPoint = new Point(0.5, 1);
            lbrush.EndPoint   = new Point(0.5, 0.014);
            GradientStop gs1 = new GradientStop();

            gs1.Color  = (Color)cc.ConvertFrom(contentBackgroundBrushes0[index]);
            gs1.Offset = 0.0d;
            GradientStop gs2 = new GradientStop();

            gs2.Color  = (Color)cc.ConvertFrom(contentBackgroundBrushes1[index]);
            gs2.Offset = 1.0d;
            lbrush.GradientStops.Add(gs1);
            lbrush.GradientStops.Add(gs2);
            return(lbrush);
        }
コード例 #29
0
ファイル: Title.cs プロジェクト: jonathandlo/deep-space-dive
        public Title(string pText, float pX, float pY)
        {
            width = Constants.Width - 2 * pX;
            height = 70;
            x = pX;
            y = pY;

            var brushProp = new LinearGradientBrushProperties();
            brushProp.StartPoint = new Vector2(x, y);
            brushProp.EndPoint = new Vector2(x, y + height);

            var stops = new GradientStop[2];
            stops[0] = new GradientStop() { Color = new Color4(0.1f, 0.3f, 0.4f, 0.5f), Position = 0 };
            stops[1] = new GradientStop() { Color = new Color4(0.1f, 0.3f, 0.4f, 0.5f), Position = 1 };

            brush = new LinearGradientBrush(GraphicsWindow.Instance.RenderTarget2D, brushProp, new GradientStopCollection(GraphicsWindow.Instance.RenderTarget2D, stops));
            textLayout = new TextLayout(Factories.FactoryWrite, pText, Constants.BoldFont, width, height);
        }
コード例 #30
0
        private LinearGradientBrush GetHeaderBackgroundBrush(int index)
        {
            LinearGradientBrush lbrush = new LinearGradientBrush();

            lbrush.StartPoint = new Point(0.5, 1.01);
            lbrush.EndPoint   = new Point(0.5, -0.086);
            GradientStop gs1 = new GradientStop();

            gs1.Color  = Colors.White;
            gs1.Offset = 1.0d;
            GradientStop gs2 = new GradientStop();

            gs2.Color  = (Color)cc.ConvertFrom(headerBackgroundBrushes[index]);
            gs2.Offset = 0.435d;
            lbrush.GradientStops.Add(gs1);
            lbrush.GradientStops.Add(gs2);
            return(lbrush);
        }
コード例 #31
0
        // Get the gradient color for basic square
        private LinearGradientBrush getGradientColor(Color clr)
        {
            LinearGradientBrush gradientColor = new LinearGradientBrush();

            gradientColor.StartPoint = new Point(0, 0);
            gradientColor.EndPoint   = new Point(1, 1.5);
            GradientStop black = new GradientStop();

            black.Color  = Colors.Black;
            black.Offset = -1.5;
            gradientColor.GradientStops.Add(black);
            GradientStop other = new GradientStop();

            other.Color  = clr;
            other.Offset = 0.70;
            gradientColor.GradientStops.Add(other);
            return(gradientColor);
        }
コード例 #32
0
        void QuitarEfectoBuzon3()
        {
            ResourceDictionary rd = new temas.temaSelva.Tema();

            this.Resources = rd;

            imgBuzon3.Style = (Style)this.Resources["GlassBorderStyle"];

            LinearGradientBrush blanco = new LinearGradientBrush();
            GradientStop        b1     = new GradientStop();

            b1.Color = Colors.White;
            blanco.GradientStops.Add(b1);

            txt13.Foreground = blanco;
            txt23.Foreground = blanco;
            txt33.Foreground = blanco;
        }
コード例 #33
0
        private Brush randomGradient()
        {
            var gradient  = new LinearGradientBrush();
            var gradstop1 = new GradientStop()
            {
                Color  = randomColor(),
                Offset = 0
            };
            var gradstop2 = new GradientStop()
            {
                Color  = randomColor(),
                Offset = 1
            };

            gradient.GradientStops.Add(gradstop1);
            gradient.GradientStops.Add(gradstop2);
            return(gradient);
        }
コード例 #34
0
ファイル: SpectrumSlider.cs プロジェクト: Trinitek/CMiX
        private void SetBackground()
        {
            LinearGradientBrush backgroundBrush = new LinearGradientBrush();

            backgroundBrush.StartPoint = new Point(0.5, 0);
            backgroundBrush.EndPoint   = new Point(0.5, 1);

            const int spectrumColorCount = 30;

            Color[] spectrumColors = ColorUtils.GetSpectrumColors(spectrumColorCount);
            for (int i = 0; i < spectrumColorCount; ++i)
            {
                double       offset       = i * 1.0 / spectrumColorCount;
                GradientStop gradientStop = new GradientStop(spectrumColors[i], offset);
                backgroundBrush.GradientStops.Add(gradientStop);
            }
            Background = backgroundBrush;
        }
コード例 #35
0
        private void imgBuzon3_MouseEnter(object sender, MouseEventArgs e)
        {
            ResourceDictionary rd = new temas.temaSelva.Tema();

            this.Resources = rd;

            imgBuzon3.Style = (Style)this.Resources["GlassBorderStyleBrillo"];

            LinearGradientBrush blanco = new LinearGradientBrush();
            GradientStop        o1     = new GradientStop();

            o1.Color = Colors.White;
            blanco.GradientStops.Add(o1);

            txt13.Foreground = blanco;
            txt23.Foreground = blanco;
            txt33.Foreground = blanco;
        }
コード例 #36
0
        internal override void Create()
        {
            if (NativeBrush != null)
                NativeBrush.Dispose();
            var stops = new GradientStop[m_gradientStops.Length];
            for (int s = 0; s < m_gradientStops.Length; s++)
            {
                stops[s].Color = m_gradientStops[s].Color.ToColor4();
                stops[s].Position = m_gradientStops[s].Position;
            }

            using (var stopcol = new GradientStopCollection(Owner.D2dRenderTarget, stops, (Gamma)m_gamma, (ExtendMode)m_extendMode))
            {
                var props = new LinearGradientBrushProperties();
                props.StartPoint = new DrawingPointF(m_start.X, m_start.Y);
                props.EndPoint = new DrawingPointF(m_end.X, m_end.Y);
                NativeBrush = new LinearGradientBrush(Owner.D2dRenderTarget, props, stopcol);
            }
        }
コード例 #37
0
        internal override WpfBrush RealizeWpfBrush()
        {
            //if (dirty)
            //{
            //  if (brush == null)
            //    brush = new SolidBrush(color.ToGdiColor());
            //  else
            //  {
            //    brush.Color = color.ToGdiColor();
            //  }
            //  dirty = false;
            //}

            System.Windows.Media.LinearGradientBrush brush;
            if (_useRect)
            {
#if !SILVERLIGHT
                brush = new System.Windows.Media.LinearGradientBrush(_color1.ToWpfColor(), _color2.ToWpfColor(), new SysPoint(0, 0), new SysPoint(1, 1));// rect.TopLeft, this.rect.BottomRight);
                //brush = new System.Drawing.Drawing2D.LinearGradientBrush(rect.ToRectangleF(),
                //  color1.ToGdiColor(), color2.ToGdiColor(), (LinearGradientMode)linearGradientMode);
#else
                GradientStop gs1 = new GradientStop();
                gs1.Color = _color1.ToWpfColor();
                gs1.Offset = 0;

                GradientStop gs2 = new GradientStop();
                gs2.Color = _color2.ToWpfColor();
                gs2.Offset = 1;

                GradientStopCollection gsc = new GradientStopCollection();
                gsc.Add(gs1);
                gsc.Add(gs2);

                brush = new LinearGradientBrush(gsc, 0);
                brush.StartPoint = new Point(0, 0);
                brush.EndPoint = new Point(1, 1);
#endif

            }
            else
            {
#if !SILVERLIGHT
                brush = new System.Windows.Media.LinearGradientBrush(_color1.ToWpfColor(), _color2.ToWpfColor(), _point1, _point2);
                //brush = new System.Drawing.Drawing2D.LinearGradientBrush(
                //  point1.ToPointF(), point2.ToPointF(),
                //  color1.ToGdiColor(), color2.ToGdiColor());
#else
                GradientStop gs1 = new GradientStop();
                gs1.Color = _color1.ToWpfColor();
                gs1.Offset = 0;

                GradientStop gs2 = new GradientStop();
                gs2.Color = _color2.ToWpfColor();
                gs2.Offset = 1;

                GradientStopCollection gsc = new GradientStopCollection();
                gsc.Add(gs1);
                gsc.Add(gs2);

                brush = new LinearGradientBrush(gsc, 0);
                brush.StartPoint = _point1;
                brush.EndPoint = _point2;
#endif
            }
            if (!_matrix.IsIdentity)
            {
#if !SILVERLIGHT
                brush.Transform = new MatrixTransform(_matrix.ToWpfMatrix());
#else
                MatrixTransform transform = new MatrixTransform();
                transform.Matrix = _matrix.ToWpfMatrix();
                brush.Transform = transform;
#endif
            }
            return brush;
        }
コード例 #38
0
ファイル: MainWindow.cs プロジェクト: eugeniomiro/Terrarium
        protected override void OnCreateDeviceResources(WindowRenderTarget renderTarget)
        {
            base.OnCreateDeviceResources(renderTarget);
            // Create an array of gradient stops to put in the gradient stop
            // collection that will be used in the gradient brush.
            GradientStop[] stops = new GradientStop[] {
                new GradientStop(0, Color.FromARGB(Colors.Gold, 1)),
                new GradientStop(0.85f, Color.FromARGB(Colors.Orange, 1)),
                new GradientStop(1, Color.FromARGB(Colors.OrangeRed, 1))
            };

            using (GradientStopCollection gradiendStops = renderTarget.CreateGradientStopCollection(stops, Gamma.Gamma22, ExtendMode.Clamp))
            {
                // The center of the gradient is in the center of the box.
                // The gradient origin offset was set to zero(0, 0) or center in this case.
                this._radialGradientBrush = renderTarget.CreateRadialGradientBrush(
                    new RadialGradientBrushProperties(
                        new PointF(330, 330),
                        new PointF(140, 140),
                        140,
                        140),
                        BrushProperties.Default,
                        gradiendStops);
            }

            this._sceneBrush = renderTarget.CreateSolidColorBrush(Color.FromARGB(Colors.Black, 1));
            this._gridPatternBrush = renderTarget.CreateGridPatternBrush(new SizeF(10, 10), Color.FromARGB(1, 0.93f, 0.94f, 0.96f));
        }
コード例 #39
0
        public virtual LinearShader ToColorShader()
        {
            GradientStop[] gradientColors = null;

            if (XmlGradient != null)
            {
                gradientColors = new GradientStop[XmlGradient.Length];

                for (int i = 0; i < XmlGradient.Length; i++)
                {
                    gradientColors[i] = XmlGradient[i].ToGradientStop();
                }
            }
            else
            {
                gradientColors = new GradientStop[2];
                gradientColors[0] = new GradientStop(new Color4(Int32.Parse(ColorValue,NumberStyles.HexNumber)),0);
                gradientColors[1] = gradientColors[0];
            }
            Type shaderType;
            switch (GradientType)
            {
                case GradientType.Radial:
                    shaderType = typeof (RadialShader);
                    break;
                default:
                    shaderType = typeof (LinearShader);
                    break;
            }

            return new LinearShader
            {
                Name = Name,
                GradientType = GradientType,
                Method = (Shader)Delegate.CreateDelegate
                                (typeof(Shader), shaderType.GetMethod(GradientType.ToString())),
                Gradient = gradientColors,
            };
        }
コード例 #40
0
ファイル: GradientEditor.cs プロジェクト: auxiliaire/cijada
 protected void addStop(GradientStop gs, int x)
 {
     gs.Left = x; // - (int)(gs.Width / 2) - 1;
     gs.Top = 1;
     gs.Parent = this;
 }
コード例 #41
0
ファイル: RadialShader.cs プロジェクト: yong-ja/starodyssey
        public static Color4[] RadialManual2(GradientStop[] gradient, int numVertex, IEnumerable<Vector2D> points, Ellipse ellipse)
        {
            Color4[] colors = new Color4[numVertex];
            int i = 0;
            foreach (Vector2D v in points)
            {

                Vector2D v1 = Vector2D.Modulate(v - ellipse.Center, new Vector2D(1/ellipse.RadiusX, 1/ellipse.RadiusY));
                //Vector2D v1 = v - ellipse.Center;
                //v1.Normalize();
                //Vector2D v1 = new Vector2D(v.X, v.Y);
                //v1.Normalize();
                double d = v1.LengthSquared();
                //double d = v1.Length();
                int index = FindGradientStops(gradient, (float)d);
                float offset = (float)MathHelper.ConvertRange
                    (gradient[index].Offset, gradient[index+1].Offset, 0, 1, Math.Sqrt(d));
                colors[i] = Color4.Lerp(gradient[index].Color, gradient[index+1].Color, offset);
                i++;
            }

            colors[0] = gradient[0].Color;

            return colors;
        }
コード例 #42
0
        public static GradientStop[] ConvertToGradientStop(Marker[] markers)
        {
            GradientStop[] gradient = new GradientStop[markers.Length];

            for (int i = 0; i < markers.Length; i++)
            {
                Marker marker = markers[i];
                gradient[i] = new GradientStop(marker.Color, marker.Offset);
            }
            return gradient;
        }
コード例 #43
0
ファイル: RadialShader.cs プロジェクト: yong-ja/starodyssey
 //public static Color4[] RadialManual3(GradientStop[] gradient, Ellipse[] ellipses, IEnumerable<Vector2D>points, int numVertex)
 //{
 //     Color4[] colors = new Color4[numVertex];
 //    int i = 0;
 //    foreach (Vector2D v in points)
 //    {
 //    }
 //}
 //static int FindEllipse(Vector2D v, Ellipse ellipse)
 //{
 //    Vector2D v1 = v - ellipse.Center;
 //    double dSqr = v1.LengthSquared();
 //}
 static int FindGradientStops(GradientStop[] gradient, float offsetSquared)
 {
     if (Math.Abs(offsetSquared - 0f) < 0.05)
         return 0;
     if (Math.Abs(offsetSquared - 1f) < 0.05)
         return gradient.Length - 2;
     for (int i = 1; i < gradient.Length-1; i++)
     {
         if (offsetSquared <= gradient[i].Offset * gradient[i].Offset)
             return i;
     }
     return gradient.Length - 2;
 }
コード例 #44
0
ファイル: MainWindow.cs プロジェクト: eugeniomiro/Terrarium
        protected override void OnCreateDeviceResources(WindowRenderTarget renderTarget)
        {
            base.OnCreateDeviceResources(renderTarget);
            this._blackBrush = renderTarget.CreateSolidColorBrush(Color.FromARGB(Colors.Black, 1));
            this._yellowGreenBrush = renderTarget.CreateSolidColorBrush(Color.FromARGB(0x9ACD32, 1));

            GradientStop[] stops = new GradientStop[] {
                new GradientStop(0, Color.FromARGB(Colors.Yellow, 1)),
                new GradientStop(1, Color.FromARGB(Colors.ForestGreen, 1))
            };

            using (GradientStopCollection collection = renderTarget.CreateGradientStopCollection(stops, Gamma.Gamma22, ExtendMode.Clamp))
            {
                this._linearGradientBrush = renderTarget.CreateLinearGradientBrush(
                    new LinearGradientBrushProperties(new PointF(0, 0), new PointF(150, 150)),
                    BrushProperties.Default,
                    collection);
                this._radialGradientBrush = renderTarget.CreateRadialGradientBrush(
                    new RadialGradientBrushProperties(new PointF(75, 75), new PointF(0, 0), 75, 75),
                    BrushProperties.Default,
                    collection);
            }

            using (Bitmap bitmap = RenderTarget.CreateBitmap(this.GetType(), "fern.jpg"))
            {
                this._bitmapBrush = renderTarget.CreateBitmapBrush(bitmap,
                    new BitmapBrushProperties(ExtendMode.Wrap, ExtendMode.Wrap, BitmapInterpolationMode.Linear),
                    BrushProperties.Default);
            }

            this._gridPatternBrush = renderTarget.CreateGridPatternBrush(new SizeF(10, 10), Color.FromARGB(1, 0.93f, 0.94f, 0.96f));
        }
コード例 #45
0
        public static Marker[] ConvertToMarkers(GradientStop[] gradient)
        {
            Marker[] markers = new Marker[gradient.Length];

            for (int i = 0; i < gradient.Length; i++)
            {
                GradientStop gradientStop = gradient[i];
                markers[i] = new Marker(gradientStop.Color.ToColor(), gradientStop.Offset);
            }
            return markers;
        }
コード例 #46
0
 public void SetMarkers(GradientStop[] gradient)
 {
     SetMarkers(ConvertToMarkers(gradient));
 }
コード例 #47
0
        internal override void Create()
        {
            if (NativeBrush != null)
                NativeBrush.Dispose();

            var stops = new GradientStop[m_gradientStops.Length];
            for (int s = 0; s < m_gradientStops.Length; s++)
            {
                stops[s].Color = m_gradientStops[s].Color.ToColor4();
                stops[s].Position = m_gradientStops[s].Position;
            }

            var props = new RadialGradientBrushProperties
            {
                Center = m_center.ToSharpDX(), 
                GradientOriginOffset = m_gradientOriginOffset.ToSharpDX(), 
                RadiusX = m_radiusX, 
                RadiusY = m_radiusY
            };

            using (var stopcol = new GradientStopCollection(Owner.D2dRenderTarget, stops, Gamma.StandardRgb, ExtendMode.Clamp))
            {
                NativeBrush = new RadialGradientBrush(Owner.D2dRenderTarget, props, stopcol);
            }
        }
コード例 #48
0
ファイル: D2dGraphics.cs プロジェクト: sbambach/ATF
        private LinearGradientBrush GetCachedLinearGradientBrush(Color color1, Color color2)
        {
            long kh = color1.ToArgb(); //  high bits
            long kl = color2.ToArgb(); //  low bits
            var colorKey = (kh << 32) | kl;

            LinearGradientBrush brush;
            if (!m_linearGradients.TryGetValue(colorKey, out brush))
            {
                var stops = new GradientStop[2];
                stops[0].Color = color1.ToColor4();
                stops[0].Position = 0;
                stops[1].Color = color2.ToColor4();
                stops[1].Position = 1;
                using (var stopCollection = new GradientStopCollection(m_renderTarget, stops, Gamma.StandardRgb, ExtendMode.Clamp))
                {
                    var props = new LinearGradientBrushProperties();
                    brush = new LinearGradientBrush(m_renderTarget, props, stopCollection);
                }
                m_linearGradients.Add(colorKey, brush);
            }

            return brush;
        }
コード例 #49
0
ファイル: Window1.xaml.cs プロジェクト: QuocHuy7a10/Arianrhod
        /// <summary>
        /// This method creates the render target and all associated D2D and DWrite resources
        /// </summary>
        void CreateDeviceResources()
        {
            // Only calls if resources have not been initialize before
            if (renderTarget == null)
            {
                // The text format
                textFormat = dwriteFactory.CreateTextFormat("Bodoni MT", 24, DWrite.FontWeight.Normal, DWrite.FontStyle.Italic, DWrite.FontStretch.Normal);

                // Create the render target
                SizeU size = new SizeU((uint)host.ActualWidth, (uint)host.ActualHeight);
                RenderTargetProperties props = new RenderTargetProperties();
                HwndRenderTargetProperties hwndProps = new HwndRenderTargetProperties(host.Handle, size, PresentOptions.None);
                renderTarget = d2dFactory.CreateHwndRenderTarget(props, hwndProps);

                // A black brush to be used for drawing text
                ColorF cf = new ColorF(0, 0, 0, 1);
                blackBrush = renderTarget.CreateSolidColorBrush(cf);

                // Create a linear gradient.
                GradientStop[] stops = 
                { 
                    new GradientStop(1, new ColorF(1f, 0f, 0f, 0.25f)),
                    new GradientStop(0, new ColorF(0f, 0f, 1f, 1f))
                };

                GradientStopCollection pGradientStops = renderTarget.CreateGradientStopCollection(stops, Gamma.Linear, ExtendMode.Wrap);
                LinearGradientBrushProperties gradBrushProps = new LinearGradientBrushProperties(new Point2F(50, 25), new Point2F(25, 50));

                linearGradientBrush = renderTarget.CreateLinearGradientBrush(gradBrushProps, pGradientStops);

                gridPatternBitmapBrush = CreateGridPatternBrush(renderTarget);

                solidBrush1 = renderTarget.CreateSolidColorBrush(new ColorF(0.3F, 0.5F, 0.65F, 0.25F));
                solidBrush2 = renderTarget.CreateSolidColorBrush(new ColorF(0.0F, 0.0F, 0.65F, 0.5F));
                solidBrush3 = renderTarget.CreateSolidColorBrush(new ColorF(0.9F, 0.5F, 0.3F, 0.75F));

                // Create a linear gradient.
                stops[0] = new GradientStop(1, new ColorF(0f, 0f, 0f, 0.25f));
                stops[1] = new GradientStop(0, new ColorF(1f, 1f, 0.2f, 1f));
                GradientStopCollection radiantGradientStops = renderTarget.CreateGradientStopCollection(stops, Gamma.Linear, ExtendMode.Wrap);

                RadialGradientBrushProperties radialBrushProps = new RadialGradientBrushProperties(new Point2F(25, 25), new Point2F(0, 0), 10, 10);
                radialGradientBrush = renderTarget.CreateRadialGradientBrush(radialBrushProps, radiantGradientStops);
            }
        }
コード例 #50
0
 public RadialLinearGradient(CSSCalcValue x, CSSCalcValue y, CSSCalcValue width, CSSCalcValue height, GradientStop[] stops, Boolean repeating)
 {
     _stops = stops;
     _x = x;
     _y = y;
     _width = width;
     _height = height;
     _repeating = repeating;
 }
コード例 #51
0
        private float[] DetailOffsets(float minDelta, int innerSegments, IGradientShader rs, out GradientStop[] gradient)
        {
            Dictionary<float, GradientStop> gradientStops = new Dictionary<float, GradientStop>
                                                            {{rs.Gradient[0].Offset, rs.Gradient[0]}};

            float prevOffset = rs.Gradient[0].Offset;
            //foreach (float offset in offsets.Skip(1))
            for (int i = 1; i < rs.Gradient.Length; i++)
            {
                GradientStop gs = rs.Gradient[i];
                float offset = gs.Offset;
                float range = offset - prevOffset;

                if (range <= minDelta)
                {
                    gradientStops.Add(gs.Offset, gs);
                    continue;
                }
                if (i > innerSegments) break;

                int numOffsets = (int) Math.Truncate(range/minDelta);
                for (int j = 1; j <= numOffsets; j++)
                {
                    float newOffset = prevOffset + j*minDelta; //(float)Math.Pow(j*minDelta,2);
                    float weight = (float) MathHelper.ConvertRange(prevOffset, offset, 0, 1.0, newOffset);

                    Color4 newColor = Color4.Lerp(rs.Gradient[i - 1].Color, rs.Gradient[i].Color, weight);
                    if (!gradientStops.Keys.Contains(newOffset))
                        gradientStops.Add(newOffset, new GradientStop(newColor, newOffset));
                }
                //if (!gradientStops.Keys.Contains(offset))
                //    gradientStops.Add(offset,gs);
                prevOffset = offset;
            }

            List<GradientStop> gList = gradientStops.Values.ToList();

            gradient = gList.ToArray();
            return (from g in gList
                    select g.Offset).ToArray();
        }
コード例 #52
0
ファイル: GradientEditor.cs プロジェクト: auxiliaire/cijada
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseUp (e);

            if (e.X > gradientX && e.X < (gradientX + gradientWidth)
                && e.Y > gradientY && e.Y < (gradientY + gradientHeight)
            ) {
                Bitmap bmp = new Bitmap(this.Width, this.Height);
                Graphics g = Graphics.FromImage(bmp);

                System.Drawing.Drawing2D.LinearGradientBrush b = getGradientBrush();

                g.FillRectangle(b, gradientX + 1, 0, gradientWidth, Height);
                b.Dispose();

                Color clr = bmp.GetPixel(e.X, e.Y);

                bmp.Dispose();
                g.Dispose();

                GradientStop grs = new GradientStop(clr, xToPos(e.X - (int)(STOP_WIDTH / 2)));
                setColorStop(grs);
                map.Sort();
                MapChanged(this, new EventArgs());
                Invalidate();
            }
        }
コード例 #53
0
 public LinearGradient(Angle angle, GradientStop[] stops, Boolean repeating)
 {
     _stops = stops;
     _angle = angle;
     _repeating = repeating;
 }
コード例 #54
0
ファイル: Program.cs プロジェクト: Spanfile/CUE.NET
        public static void Main(string[] args)
        {
            Console.WriteLine("Press any key to exit ...");
            Console.WriteLine();
            Task.Factory.StartNew(
                () =>
                {
                    Console.ReadKey();
                    Environment.Exit(0);
                });

            try
            {
                // Initialize CUE-SDK
                CueSDK.Initialize();
                Console.WriteLine("Initialized with " + CueSDK.LoadedArchitecture + "-SDK");

                // Get connected keyboard or throw exception if there is no light controllable keyboard connected
                CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
                if (keyboard == null)
                    throw new WrapperException("No keyboard found");


                // ---------------------------------------------------------------------------
                // First we'll look at some basic coloring

                Console.WriteLine("Basic color-test ...");
                // Ink all numbers on the keypad except the '5' purple, we want that to be gray
                ListKeyGroup purpleGroup = new RectangleKeyGroup(keyboard, CorsairKeyboardKeyId.Keypad7, CorsairKeyboardKeyId.Keypad3)
                { Brush = new SolidColorBrush(Color.Purple) }
                .Exclude(CorsairKeyboardKeyId.Keypad5);
                keyboard[CorsairKeyboardKeyId.Keypad5].Led.Color = Color.Gray;

                // Ink the Keys 'r', 'g', 'b' in their respective color
                // The char access fails for everything except letters (SDK doesn't return a valid keyId)
                keyboard['R'].Led.Color = Color.Red;
                keyboard[CorsairKeyboardKeyId.G].Led.Color = Color.Green;
                keyboard['B'].Led.Color = Color.Blue;

                // Lock the 'r', 'g', 'b' keys. We want them to stay like this forever (commented since it looks quite stupid later, but feel free tu uncomment this)
                //keyboard['R'].Led.IsLocked = true;
                //keyboard['G'].Led.IsLocked = true;
                //keyboard['B'].Led.IsLocked = true;

                // Ink the letters of 'white' white
                ListKeyGroup whiteGroup = new ListKeyGroup(keyboard, CorsairKeyboardKeyId.W, CorsairKeyboardKeyId.H, CorsairKeyboardKeyId.I, CorsairKeyboardKeyId.T, CorsairKeyboardKeyId.E)
                { Brush = new SolidColorBrush(Color.White) };

                // Ink the keys '1' to '0' yellow
                RectangleKeyGroup yellowGroup = new RectangleKeyGroup(keyboard, CorsairKeyboardKeyId.D1, CorsairKeyboardKeyId.D0)
                { Brush = new SolidColorBrush(Color.Yellow) };

                // Update the keyboard to show the configured colors, (your CUE settings defines the rest)
                keyboard.Update();

                Wait(3);

                // Remove all the groups we created above to clear the keyboard
                purpleGroup.Detach();
                whiteGroup.Detach();
                yellowGroup.Detach();


                // ---------------------------------------------------------------------------
                // Next we add a nice linear gradient brush over the keyboard and play around with the offset of one stop

                Console.WriteLine("gradient-brush-test");

                // Create our gradient stop to play with
                GradientStop moveableStop = new GradientStop(0, Color.FromArgb(0, 255, 0));

                // Create a basic (by default horizontal) brush ...
                LinearGradientBrush linearBrush = new LinearGradientBrush(new LinearGradient(new GradientStop(0, Color.Blue), moveableStop, new GradientStop(1f, Color.White)));

                // ... and add it as the keyboard background
                keyboard.Brush = linearBrush;

                // Move the brush from left to right
                for (float offset = 0; offset <= 1f; offset += 0.02f)
                {
                    moveableStop.Offset = offset;
                    keyboard.Update();
                    Thread.Sleep(100);
                }

                // And back to center
                for (float offset = 1f; offset >= 0.5f; offset -= 0.02f)
                {
                    moveableStop.Offset = offset;
                    keyboard.Update();
                    Thread.Sleep(100);
                }

                // "Rotate" the brush (this is of course not the best implementation for this but you see the point)
                for (float rotateX = 0, rotateY = 0; rotateX <= 1f; rotateX += 0.02f, rotateY = 0.04f)
                {
                    if (rotateY > 1f)
                        rotateY = 1f - (rotateY - 1f);

                    linearBrush.StartPoint = new PointF(rotateX, rotateY);
                    linearBrush.EndPoint = new PointF(1f - rotateX, 1f - rotateY);

                    keyboard.Update();
                    Thread.Sleep(100);
                }

                Wait(2);

                // ---------------------------------------------------------------------------
                // Time for an even better brush: rainbow

                Console.WriteLine("rainbow-test");

                // Create an simple horizontal rainbow containing two times the full spectrum
                RainbowGradient rainbowGradient = new RainbowGradient(0, 720);

                // Add the rainbow to the keyboard and perform an initial update
                keyboard.Brush = new LinearGradientBrush(rainbowGradient);
                keyboard.Update();

                // Let the rainbow move around for 10 secs
                for (int i = 0; i < 100; i++)
                {
                    rainbowGradient.StartHue += 10f;
                    rainbowGradient.EndHue += 10f;
                    keyboard.Update();
                    Thread.Sleep(100);
                }

                Wait(2);


                // ---------------------------------------------------------------------------
                // Now let us move some points random over the keyboard
                // Something like this could become some sort of effect

                // Initialize needed stuff
                const float SPEED = 6f; // mm/tick
                Random random = new Random();

                // Flash whole keyboard three times to ... well ... just to make it happen
                for (int i = 0; i < 3; i++)
                {
                    keyboard.Brush = new SolidColorBrush(Color.Aquamarine);
                    keyboard.Update();
                    Thread.Sleep(160);
                    keyboard.Brush = new SolidColorBrush(Color.Black);
                    keyboard.Update();
                    Thread.Sleep(200);
                }

                // Set keyboard 'background' to black with low alpha (this will add a nice "fade" effect instead of just clearing the keyboard every frame)
                keyboard.Brush = new SolidColorBrush(Color.FromArgb(25, 0, 0, 0));

                // Define how many points we have
                const int NUM_POINTS = 6;

                // The points we want to draw (rectangle since circles are too hard to calculate :p)
                RectangleF[] points = new RectangleF[NUM_POINTS];

                // KeyGroups which represents our point on the keyboard
                RectangleKeyGroup[] pointGroups = new RectangleKeyGroup[NUM_POINTS];

                // Target of our movement
                PointF[] targets = new PointF[NUM_POINTS];

                // Initialize all the stuff
                for (int i = 0; i < NUM_POINTS; i++)
                {
                    // Spawn our point  in the top-left corner (right over G1 or on ESC depending on your keyboard)
                    points[i] = new RectangleF(keyboard.KeyboardRectangle.X, keyboard.KeyboardRectangle.Y, 60, 60);
                    pointGroups[i] = new RectangleKeyGroup(keyboard, points[i], 0.1f) { Brush = new SolidColorBrush(Color.White) };
                    targets[i] = new PointF(points[i].X, points[i].Y);
                }

                // We set colors manually since white points are kinda boring (notice, that we use alpha values)
                pointGroups[0].Brush = new SolidColorBrush(Color.FromArgb(127, 255, 0, 0));
                pointGroups[1].Brush = new SolidColorBrush(Color.FromArgb(127, 0, 255, 0));
                pointGroups[2].Brush = new SolidColorBrush(Color.FromArgb(127, 0, 0, 255));
                pointGroups[3].Brush = new SolidColorBrush(Color.FromArgb(127, 255, 0, 255));
                pointGroups[4].Brush = new SolidColorBrush(Color.FromArgb(127, 255, 255, 0));
                pointGroups[5].Brush = new SolidColorBrush(Color.FromArgb(127, 0, 255, 255));

                while (true)
                {
                    // Calculate all the points
                    for (int i = 0; i < NUM_POINTS; i++)
                    {
                        // Choose new target if we arrived
                        if (points[i].Contains(targets[i]))
                            targets[i] = new PointF((float)(keyboard.KeyboardRectangle.X + (random.NextDouble() * keyboard.KeyboardRectangle.Width)),
                                    (float)(keyboard.KeyboardRectangle.Y + (random.NextDouble() * keyboard.KeyboardRectangle.Height)));
                        else
                            // Calculate movement
                            points[i].Location = Interpolate(points[i].Location, targets[i], SPEED); // It would be better to calculate from the center of our rectangle but the easy way is enough here

                        // Move our rectangle to the new position
                        pointGroups[i].Rectangle = points[i];
                    }

                    // Update changed leds
                    keyboard.Update();

                    // 20 updates per sec should be enought for this
                    Thread.Sleep(50);
                }
            }
            catch (CUEException ex)
            {
                Console.WriteLine("CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error));
            }
            catch (WrapperException ex)
            {
                Console.WriteLine("Wrapper Exception! Message:" + ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception! Message:" + ex.Message);
            }

            while (true)
                Thread.Sleep(1000); // Don't exit after exception
        }
コード例 #55
0
ファイル: GradientEditor.cs プロジェクト: auxiliaire/cijada
 public void removeColorStop(GradientStop gs)
 {
     //int order) {
     map.Remove(gs);
 }
コード例 #56
0
ファイル: SLFill.cs プロジェクト: mousetwentytwo/test
 /// <summary>
 /// Set a gradient stop given a position and a color. Used in conjunction with SetCustomGradient().
 /// </summary>
 /// <param name="Position">Specifies position of the color, ranging from 0.0 to 1.0.</param>
 /// <param name="Color">The color to be used.</param>
 public void AppendGradientStop(double Position, System.Drawing.Color Color)
 {
     SLColor clr = new SLColor(this.listThemeColors, this.listIndexedColors);
     clr.Rgb = string.Format("{0}{1}{2}", Color.R.ToString("x2"), Color.G.ToString("x2"), Color.B.ToString("x2"));
     GradientStop gs = new GradientStop();
     gs.Position = Position;
     gs.Color = clr.ToSpreadsheetColor();
     listGradientStops.Add(gs);
 }
コード例 #57
0
ファイル: SLFill.cs プロジェクト: mousetwentytwo/test
        private void SetGradientFill(SLGradientShadingStyleValues ShadingStyle, SLColor Color1, SLColor Color2)
        {
            GradientStop gs;

            switch (ShadingStyle)
            {
                case SLGradientShadingStyleValues.Horizontal1:
                    this.Degree = 90;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.Horizontal2:
                    this.Degree = 270;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.Horizontal3:
                    this.Degree = 90;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 0.5;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.Vertical1:
                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.Vertical2:
                    this.Degree = 180;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.Vertical3:
                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 0.5;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.DiagonalUp1:
                    this.Degree = 45;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.DiagonalUp2:
                    this.Degree = 225;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.DiagonalUp3:
                    this.Degree = 45;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 0.5;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.DiagonalDown1:
                    this.Degree = 135;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.DiagonalDown2:
                    this.Degree = 315;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.DiagonalDown3:
                    this.Degree = 135;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 0.5;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.Corner1:
                    this.Type = GradientValues.Path;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.Corner2:
                    this.Type = GradientValues.Path;
                    this.Left = 1;
                    this.Right = 1;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.Corner3:
                    this.Type = GradientValues.Path;
                    this.Top = 1;
                    this.Bottom = 1;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.Corner4:
                    this.Type = GradientValues.Path;
                    this.Left = 1;
                    this.Right = 1;
                    this.Top = 1;
                    this.Bottom = 1;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
                case SLGradientShadingStyleValues.FromCenter:
                    this.Type = GradientValues.Path;
                    this.Left = 0.5;
                    this.Right = 0.5;
                    this.Top = 0.5;
                    this.Bottom = 0.5;

                    gs = new GradientStop();
                    gs.Position = 0;
                    gs.Color = Color1.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);

                    gs = new GradientStop();
                    gs.Position = 1;
                    gs.Color = Color2.ToSpreadsheetColor();
                    this.listGradientStops.Add(gs);
                    break;
            }
        }
コード例 #58
0
ファイル: GradientEditor.cs プロジェクト: auxiliaire/cijada
 public void setColorStop(GradientStop s)
 {
     map.Add(s);
     _addStopEventHandlers((Control)s);
     addStop(s, posToX(s.position));
 }
コード例 #59
0
ファイル: SLFill.cs プロジェクト: mousetwentytwo/test
 /// <summary>
 /// Set a gradient stop given a position and a color. Used in conjunction with SetCustomGradient().
 /// </summary>
 /// <param name="Position">Specifies position of the color, ranging from 0.0 to 1.0.</param>
 /// <param name="ColorTheme">The theme color to be used.</param>
 /// <param name="ColorTint">The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
 public void AppendGradientStop(double Position, SLThemeColorIndexValues ColorTheme, double ColorTint)
 {
     SLColor clr = new SLColor(this.listThemeColors, this.listIndexedColors);
     clr.SetThemeColor(ColorTheme, ColorTint);
     GradientStop gs = new GradientStop();
     gs.Position = Position;
     gs.Color = clr.ToSpreadsheetColor();
     listGradientStops.Add(gs);
 }
コード例 #60
0
 public XmlGradientStop(GradientStop gradientStop)
     : this()
 {
     Color = gradientStop.Color.ToArgb().ToString("X8");
     Offset = gradientStop.Offset;
 }