[hyena/gtk3] Gui: Use the GdkRGBAToCairoColor utility method



commit cce17c4452ba85c725f4772e9923302036b6fa61
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sun Jul 10 21:26:14 2011 +0200

    Gui: Use the GdkRGBAToCairoColor utility method

 Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs  |    6 ++----
 Hyena.Gui/Hyena.Widgets/MessageBar.cs    |    2 +-
 Hyena.Gui/Hyena.Widgets/PulsingButton.cs |    2 +-
 Hyena.Gui/Hyena.Widgets/SegmentedBar.cs  |    2 +-
 4 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs b/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
index c2dfdfc..9449bd3 100644
--- a/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
+++ b/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
@@ -43,10 +43,8 @@ namespace Hyena.Gui.Theming
 
         public static Cairo.Color GetCairoTextMidColor (Widget widget)
         {
-            Gdk.RGBA color = widget.StyleContext.GetColor (StateFlags.Normal);
-            Cairo.Color text_color = new Cairo.Color (color.Red, color.Green, color.Blue, color.Alpha);
-            color = widget.StyleContext.GetBackgroundColor (StateFlags.Normal);
-            Cairo.Color background_color = new Cairo.Color (color.Red, color.Green, color.Blue, color.Alpha);
+            Cairo.Color text_color = CairoExtensions.GdkRGBAToCairoColor (widget.StyleContext.GetColor (StateFlags.Normal));
+            Cairo.Color background_color = CairoExtensions.GdkRGBAToCairoColor (widget.StyleContext.GetBackgroundColor (StateFlags.Normal));
             return CairoExtensions.AlphaBlend (text_color, background_color, 0.5);
         }
 
diff --git a/Hyena.Gui/Hyena.Widgets/MessageBar.cs b/Hyena.Gui/Hyena.Widgets/MessageBar.cs
index 40a2121..99ec117 100644
--- a/Hyena.Gui/Hyena.Widgets/MessageBar.cs
+++ b/Hyena.Gui/Hyena.Widgets/MessageBar.cs
@@ -128,7 +128,7 @@ namespace Hyena.Widgets
             CairoHelper.TransformToWindow (cr, this, Window);
 
             Gdk.RGBA color = StyleContext.GetBackgroundColor (StateFlags.Normal);
-            theme.DrawFrame (cr, Allocation, new Cairo.Color (color.Red, color.Green, color.Blue, color.Alpha));
+            theme.DrawFrame (cr, Allocation, CairoExtensions.GdkRGBAToCairoColor (color));
             cr.Restore ();
             return base.OnDrawn (cr);
         }
diff --git a/Hyena.Gui/Hyena.Widgets/PulsingButton.cs b/Hyena.Gui/Hyena.Widgets/PulsingButton.cs
index d0f3368..78e498a 100644
--- a/Hyena.Gui/Hyena.Widgets/PulsingButton.cs
+++ b/Hyena.Gui/Hyena.Widgets/PulsingButton.cs
@@ -97,7 +97,7 @@ namespace Hyena.Widgets
             double alpha = Choreographer.Compose (pulsator.Percent, Easing.Sine);
 
             Gdk.RGBA rgba = StyleContext.GetBackgroundColor (StateFlags.Selected);
-            Cairo.Color color = new Cairo.Color (rgba.Red, rgba.Green, rgba.Blue, rgba.Alpha);
+            Cairo.Color color = CairoExtensions.GdkRGBAToCairoColor (rgba);
             Cairo.RadialGradient fill = new Cairo.RadialGradient (x, y, 0, x, y, r);
             color.A = alpha;
             fill.AddColorStop (0, color);
diff --git a/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs b/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
index 1d368a7..9113748 100644
--- a/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
+++ b/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
@@ -485,7 +485,7 @@ namespace Hyena.Widgets
 
             Pango.Layout layout = null;
             Gdk.RGBA rgba = StyleContext.GetColor (StateFlags);
-            Color text_color = new Cairo.Color (rgba.Red, rgba.Green, rgba.Blue, rgba.Alpha);
+            Color text_color = CairoExtensions.GdkRGBAToCairoColor (rgba);
             Color box_stroke_color = new Color (0, 0, 0, 0.6);
 
             int x = 0;



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