[longomatch] Draw buttons without gradients



commit dad6f4b3bf5f545d7d0f37428cb93a06e9b9eb3d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Oct 8 02:09:33 2014 +0200

    Draw buttons without gradients

 .../Interfaces/Drawing/IDrawingToolkit.cs          |    2 --
 LongoMatch.Drawing.Cairo/CairoBackend.cs           |   18 ------------------
 LongoMatch.Drawing/CanvasObjects/ButtonObject.cs   |   16 ++++++++++++----
 LongoMatch.Drawing/CanvasObjects/TaggerObject.cs   |    6 ++++++
 4 files changed, 18 insertions(+), 24 deletions(-)
---
diff --git a/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs 
b/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs
index 1e15403..1eb3bbe 100644
--- a/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs
+++ b/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs
@@ -60,8 +60,6 @@ namespace LongoMatch.Core.Interfaces.Drawing
                                   SelectionPosition orientation);
                void DrawRectangle (Point start, double width, double height);
                void DrawRoundedRectangle (Point start, double width, double height, double radius);
-               void DrawButton (Point start, double width, double height, double radius,
-                                Color startColor, Color stopColor);
                void DrawArea (params Point[] vertices);
                void DrawPoint (Point point);
                void DrawCircle (Point center, double radius);
diff --git a/LongoMatch.Drawing.Cairo/CairoBackend.cs b/LongoMatch.Drawing.Cairo/CairoBackend.cs
index 886989b..1ad508a 100644
--- a/LongoMatch.Drawing.Cairo/CairoBackend.cs
+++ b/LongoMatch.Drawing.Cairo/CairoBackend.cs
@@ -295,24 +295,6 @@ namespace LongoMatch.Drawing.Cairo
                                                        ByteToDouble (c.B));
                }
 
-               public void DrawButton (Point start, double width, double height, double radius, Color 
startColor, Color stopColor)
-               {
-                       LinearGradient p;
-                       DrawRoundedRectangle (start, width, height, radius, false);
-                       p = new LinearGradient (start.X, start.Y, start.X, start.Y + height);
-                       p.AddColorStop (0, RGBToCairoColor (startColor));
-                       p.AddColorStop (1, RGBToCairoColor (stopColor));
-                       CContext.Pattern = p;
-                       CContext.LineCap = LineCap.Round;
-                       CContext.LineJoin = LineJoin.Round;
-                       CContext.LineWidth = LineWidth;
-                       CContext.FillPreserve ();
-                       SetColor (StrokeColor);
-                       CContext.StrokePreserve ();
-                       CContext.Stroke ();
-                       p.Dispose ();
-               }
-
                public void DrawRoundedRectangle (Point start, double width, double height, double radius)
                {
                        DrawRoundedRectangle (start, width, height, radius, true);
diff --git a/LongoMatch.Drawing/CanvasObjects/ButtonObject.cs 
b/LongoMatch.Drawing/CanvasObjects/ButtonObject.cs
index 06d924c..157eb10 100644
--- a/LongoMatch.Drawing/CanvasObjects/ButtonObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/ButtonObject.cs
@@ -27,7 +27,8 @@ namespace LongoMatch.Drawing.CanvasObjects
                const int BORDER_SIZE = 4;
 
                public ButtonObject () {
-                       BackgroundColor = Config.Style.PaletteBackground;
+                       BackgroundColor = Config.Style.PaletteBackgroundLight;
+                       BackgroundColorActive = Config.Style.PaletteActive;
                        BorderColor = Config.Style.PaletteBackgroundDark;
                        TextColor = Config.Style.PaletteText;
                }
@@ -61,6 +62,11 @@ namespace LongoMatch.Drawing.CanvasObjects
                        get;
                        set;
                }
+               
+               public virtual Color BackgroundColorActive {
+                       get;
+                       set;
+               }
 
                public virtual Color TextColor {
                        get;
@@ -70,9 +76,9 @@ namespace LongoMatch.Drawing.CanvasObjects
                protected Color CurrentBackgroundColor {
                        get {
                                if (!Active) {
-                                       return BorderColor;
-                               } else {
                                        return BackgroundColor;
+                               } else {
+                                       return BackgroundColorActive;
                                }
                        }
                }
@@ -169,7 +175,9 @@ namespace LongoMatch.Drawing.CanvasObjects
                protected void DrawButton (IDrawingToolkit tk)
                {
                        tk.LineWidth = 0;
-                       tk.DrawButton (DrawPosition, Width, Height, 3, BorderColor, CurrentBackgroundColor);
+                       tk.StrokeColor = BorderColor;
+                       tk.FillColor = CurrentBackgroundColor;
+                       tk.DrawRoundedRectangle (DrawPosition, Width, Height, 3);
                }
 
                protected void DrawImage (IDrawingToolkit tk)
diff --git a/LongoMatch.Drawing/CanvasObjects/TaggerObject.cs 
b/LongoMatch.Drawing/CanvasObjects/TaggerObject.cs
index bb5ab00..f28644b 100644
--- a/LongoMatch.Drawing/CanvasObjects/TaggerObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/TaggerObject.cs
@@ -67,6 +67,12 @@ namespace LongoMatch.Drawing.CanvasObjects
 
                public override Color BackgroundColor {
                        get {
+                               return Tagger.BackgroundColor;
+                       }
+               }
+               
+               public override Color BackgroundColorActive {
+                       get {
                                return Tagger.DarkColor;
                        }
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]