[longomatch] Simplify YCbCr conversion API



commit b857d6737217467d9b96ed543a8556a952cc330a
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Feb 27 13:33:12 2015 +0100

    Simplify YCbCr conversion API

 LongoMatch.Core/Common/Color.cs          |    8 ++++----
 LongoMatch.Core/Store/DashboardButton.cs |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Color.cs b/LongoMatch.Core/Common/Color.cs
index 0aeb4ad..0191971 100644
--- a/LongoMatch.Core/Common/Color.cs
+++ b/LongoMatch.Core/Common/Color.cs
@@ -161,12 +161,12 @@ namespace LongoMatch.Core.Common
                        return new YCbCrColor (Y, Cb, Cr);
                }
 
-               public static Color ColorFromYCbCr (YCbCrColor c) {
+               public Color RGBColor () {
                        double r, g, b;
 
-                       r = (1.164 * (c.Y - 16) + 1.596 * (c.Cr - 128));
-                       g = (1.164 * (c.Y - 16) - 0.392 * (c.Cb - 128) - 0.813 * (c.Cr - 128));
-                       b = (1.164 * (c.Y - 16) + 2.017 * (c.Cb - 128));
+                       r = (1.164 * (Y - 16) + 1.596 * (Cr - 128));
+                       g = (1.164 * (Y - 16) - 0.392 * (Cb - 128) - 0.813 * (Cr - 128));
+                       b = (1.164 * (Y - 16) + 2.017 * (Cb - 128));
 
                        return new Color (
                                (byte) Math.Max(0, Math.Min (r, 255)),
diff --git a/LongoMatch.Core/Store/DashboardButton.cs b/LongoMatch.Core/Store/DashboardButton.cs
index fa3d833..02bc949 100644
--- a/LongoMatch.Core/Store/DashboardButton.cs
+++ b/LongoMatch.Core/Store/DashboardButton.cs
@@ -82,7 +82,7 @@ namespace LongoMatch.Core.Store
                                YCbCrColor c = YCbCrColor.YCbCrFromColor (BackgroundColor);
                                byte y = c.Y;
                                c.Y = (byte)(Math.Min (y + 50, 255));
-                               return YCbCrColor.ColorFromYCbCr (c);
+                               return c.RGBColor ();
                        }
                }
 
@@ -92,7 +92,7 @@ namespace LongoMatch.Core.Store
                                YCbCrColor c = YCbCrColor.YCbCrFromColor (BackgroundColor);
                                byte y = c.Y;
                                c.Y = (byte)(Math.Max (y - 50, 0));
-                               return YCbCrColor.ColorFromYCbCr (c);
+                               return c.RGBColor ();
                        }
                }
        }


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