[cogl/wip/cogl-sharp: 5/51] cogl-sharp: Gives 2 constuctors to Color



commit 0198b0e9a258ab0aed743623b0ae8ab7da4cf6b6
Author: Damien Lespiau <damien lespiau intel com>
Date:   Sat Sep 29 20:58:32 2012 +0100

    cogl-sharp: Gives 2 constuctors to Color
    
    CoglColor can be initialized with floats or bytes, let's expose the same
    convience here.

 cogl-sharp/Color.cs |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/cogl-sharp/Color.cs b/cogl-sharp/Color.cs
index e01edaf..3b98517 100644
--- a/cogl-sharp/Color.cs
+++ b/cogl-sharp/Color.cs
@@ -36,6 +36,22 @@ namespace Cogl
         public float blue;
         public float alpha;
 
+        public Color(float r, float g, float b, float a)
+        {
+            red = r;
+            green = g;
+            blue = b;
+            alpha = a;
+        }
+
+        public Color(byte r, byte g, byte b, byte a)
+        {
+            red = r / 255.0f;
+            green = g / 255.0f;
+            blue = b / 255.0f;
+            alpha = a / 255.0f;
+        }
+
         [DllImport("cogl2.dll")]
         private static extern void cogl_color_premultiply(ref Color color);
 



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