[longomatch] Add a conversion helper for Color



commit 89b8541b3b3847b268522ef53a15e8aba186bfdc
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Dec 22 22:34:58 2011 +0100

    Add a conversion helper for Color

 LongoMatch.Core/Common/Color.cs |   36 ++++++++++++++++++++++++++++++++++++
 LongoMatch.Core/Makefile.am     |    1 +
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Color.cs b/LongoMatch.Core/Common/Color.cs
new file mode 100644
index 0000000..129b3c9
--- /dev/null
+++ b/LongoMatch.Core/Common/Color.cs
@@ -0,0 +1,36 @@
+// 
+//  Copyright (C) 2011 Andoni Morales Alastruey
+// 
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//  
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+// 
+using System;
+
+namespace LongoMatch.Common
+{
+	public class ColorHelper
+	{
+		
+		static public ushort ByteToShort (Byte val) {
+			var ret = (ushort) (((float)val) / byte.MaxValue * ushort.MaxValue);
+			Console.WriteLine ("IN byte" + val + "Out short" + ret);
+			return ret;
+		}
+		
+		static public byte ShortToByte (ushort val) {
+			return (byte) (((float)val) / ushort.MaxValue * byte.MaxValue);
+		}
+	}
+}
+
diff --git a/LongoMatch.Core/Makefile.am b/LongoMatch.Core/Makefile.am
index 4213a7e..5d231c8 100644
--- a/LongoMatch.Core/Makefile.am
+++ b/LongoMatch.Core/Makefile.am
@@ -6,6 +6,7 @@ LINK = $(REF_DEP_LONGOMATCH_CORE)
 SOURCES = \
 	Common/CaptureSettings.cs \
 	Common/Cloner.cs \
+	Common/Color.cs \
 	Common/ConsoleCrayon.cs \
 	Common/Constants.cs \
 	Common/Device.cs \



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