Add High Level classes for Color, Size, Position
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / manual / csharp / Color.cs
1 namespace Dali {
2
3 using System;
4
5 public class Color : Vector4
6        {
7   /**
8    * @brief constructor
9    *
10    * @since 1.0.0
11    */
12            public Color()
13                : base()
14            { }
15   /**
16    * @brief constructor
17    *
18    * @since 1.0.0
19    * @param [in] red The Color r.
20    * @param [in] green The Color g.
21    * @param [in] blue The Color b.
22    * @param [in] alpha The Color a.
23    */
24            public Color(float red, float green, float blue, float alpha)
25                : base(red, green, blue, alpha)
26            { }
27    
28   /**
29    * @brief constructor
30    *
31    * @since 1.0.0
32    * @param [in] o The Vector Position r, g, b, a.
33    */
34           public Color(Vector4 o)
35                : base(o.x, o.y, o.z, o.w)
36           {
37                  
38           }
39
40   /**
41    * @brief constructor
42    *
43    * @since 1.0.0
44    * @param [in] color as string.
45    */
46            public Color(string color)
47                : base(0, 0, 0, 0)
48            {
49                switch (color)
50                {
51                    case "red":
52                        SetColor(255, 0, 0, 255);
53                        break;
54                    case "white":
55                        SetColor(255, 255, 255, 255);
56                        break;
57                    case "blue":
58                        SetColor(0, 0, 255, 255);
59                        break;
60                    case "green":
61                        SetColor(0, 255, 0, 255);
62                        break;
63                    case "black":
64                        SetColor(0, 0, 0, 255);
65                        break;
66                    case "grey":
67                        SetColor(128, 128, 128, 255);
68                        break;
69                    case "yellow":
70                        SetColor(255, 255, 0, 255);
71                        break;
72                    case "azure":
73                        SetColor(0, 255, 255, 255);
74                        break;
75                    case "rose":
76                        SetColor(255, 0, 255, 255);
77                        break;
78                }
79            }
80    
81   /**
82    * @brief SetColor
83    *
84    * @since 1.0.0
85    * @param [in] red The Color r.
86    * @param [in] green The Color g.
87    * @param [in] blue The Color b.
88    * @param [in] alpha The Color a.
89    */
90            public void SetColor(float red, float green, float blue, float alpha)
91            { 
92                r = red;
93                g = green;
94                b = blue;
95                a = alpha;
96            }
97
98   ///< name "R", type float (Color R value)
99   //@since 1.0.0
100            public float R
101            {
102                get { return r; }
103                set { r = value; }
104            }
105
106   ///< name "G", type float (Color G value)
107   //@since 1.0.0
108            public float G
109            {
110                get { return g; }
111                set { g = value; }
112            }
113
114   ///< name "B", type float (Color B value)
115   //@since 1.0.0
116            public float B
117            {
118                get { return b; }
119                set { b = value; }
120            }
121
122   ///< name "A", type float (Color A value)
123   //@since 1.0.0
124            public float A
125            {
126                get { return a; }
127                set { a = value; }
128            }
129
130   /**
131    * @brief Equals
132    *
133    * @since 1.0.0
134    * @param [in] o The Color object to compare.
135    * @param [in] r The Color to add
136    * @return bool, whether object equal or not
137    */
138            public override bool Equals(object obj)
139            {
140                Color l = this;
141                Color r = obj as Color;
142                if (r == null)
143                {
144                    return false;
145                }
146                return l.R == r.R && l.G == r.G && l.B == r.B && l.A == r.A;
147            }
148
149   /**
150    * @brief GetHashCode
151    *
152    * @since 1.0.0
153    * @return int, hascode of Color
154    */
155            public override int GetHashCode()
156            {
157                return base.GetHashCode();
158            }
159
160   /**
161    * @brief Clone
162    *
163    * @since 1.0.0
164    * @return Color object
165    */
166            public Color Clone()
167            {
168                Color copy = new Color(R, G, B, A);
169                return copy;
170            }
171        }
172
173 }