Exemple #1
0
        public ColorGradient Clone()
        {
            var clone = new ColorGradient();

            foreach (var point in this)
            {
                clone.Add(point.Clone());
            }
            return(clone);
        }
Exemple #2
0
 public static void DrawVerticalGradientRect(Vector2 a, Vector2 b, ColorGradient gradient)
 {
     staticVertices[0] = new Vertex {
         Pos = a, Color = gradient.A
     };
     staticVertices[1] = new Vertex {
         Pos = new Vector2(b.X, a.Y), Color = gradient.A
     };
     staticVertices[2] = new Vertex {
         Pos = b, Color = gradient.B
     };
     staticVertices[3] = new Vertex {
         Pos = new Vector2(a.X, b.Y), Color = gradient.B
     };
     DrawTriangleFan(WidgetMaterial.Diffuse, staticVertices, 4);
 }
Exemple #3
0
 public static void DrawHorizontalGradientRect(Vector2 a, Vector2 b, ColorGradient gradient)
 {
     FindMinMaxGradientPointColors(gradient, out Color4 colorA, out Color4 colorB);
     staticVertices[0] = new Vertex {
         Pos = a, Color = colorA
     };
     staticVertices[1] = new Vertex {
         Pos = new Vector2(b.X, a.Y), Color = colorB
     };
     staticVertices[2] = new Vertex {
         Pos = b, Color = colorB
     };
     staticVertices[3] = new Vertex {
         Pos = new Vector2(a.X, b.Y), Color = colorA
     };
     DrawTriangleFan(null, null, WidgetMaterial.Diffuse, staticVertices, 4);
 }
Exemple #4
0
            public virtual void SetState(string state)
            {
                CommonWindow.Current.Invalidate();
                switch (state)
                {
                case "Press":
                    innerGradient = Theme.Colors.ButtonPress;
                    break;

                case "Focus":
                    innerGradient = Theme.Colors.ButtonHover;
                    break;

                case "Disable":
                    innerGradient = Theme.Colors.ButtonDisable;
                    break;

                default:
                    innerGradient = Theme.Colors.ButtonDefault;
                    break;
                }
            }
Exemple #5
0
        public static void FindMinMaxGradientPointColors(ColorGradient gradient, out Color4 minPointColor, out Color4 maxPointColor)
        {
            var min = float.MaxValue;
            var max = float.MinValue;

            minPointColor = Color4.Zero;
            maxPointColor = Color4.Zero;
            foreach (var point in gradient)
            {
                if (point.Position < min)
                {
                    minPointColor = point.Color;
                    min           = point.Position;
                }

                if (point.Position > max)
                {
                    maxPointColor = point.Color;
                    max           = point.Position;
                }
            }
        }
Exemple #6
0
 public ButtonPresenter()
 {
     innerGradient = Theme.Colors.ButtonDefault;
 }
Exemple #7
0
 public static void DrawVerticalGradientRect(float x0, float y0, float x1, float y1, ColorGradient gradient)
 {
     DrawVerticalGradientRect(new Vector2(x0, y0), new Vector2(x1, y1), gradient);
 }