[cogl/wip/cogl-sharp: 5/13] cogl-sharp: Gives 2 constuctors to Color
- From: Damien Lespiau <dlespiau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/cogl-sharp: 5/13] cogl-sharp: Gives 2 constuctors to Color
- Date: Sun, 30 Sep 2012 17:48:45 +0000 (UTC)
commit fea785e9836e8ee2dd4640c0a7190efe7b58af09
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 a19cc7c..61bfde9 100644
--- a/cogl-sharp/Color.cs
+++ b/cogl-sharp/Color.cs
@@ -11,6 +11,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]