5 public class Color : Vector4
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.
24 public Color(float red, float green, float blue, float alpha)
25 : base(red, green, blue, alpha)
32 * @param [in] o The Vector4 having r g b a components
34 public Color(Vector4 o)
35 : base(o.x, o.y, o.z, o.w)
44 * @param [in] color as string.
46 public Color(string color)
52 SetColor(255, 0, 0, 255);
55 SetColor(255, 255, 255, 255);
58 SetColor(0, 0, 255, 255);
61 SetColor(0, 255, 0, 255);
64 SetColor(0, 0, 0, 255);
67 SetColor(128, 128, 128, 255);
70 SetColor(255, 255, 0, 255);
73 SetColor(0, 255, 255, 255);
76 SetColor(255, 0, 255, 255);
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.
90 public void SetColor(float red, float green, float blue, float alpha)
99 * @brief name "R", type float (Color's Red component)
110 * @brief name "G", type float (Color's Green component)
120 * @brief name "B", type float (Color's Blue component)
130 * @brief name "A", type float (Color's Alpha value)
143 * @param [in] l The Color to add.
144 * @param [in] r The Color to add
145 * @return A reference to this
147 public static Color operator +(Color l, Color r)
149 return new Color(l.R + r.R, l.G + r.G, l.B + r.B, l.A + r.A);
156 * @param [in] l The Color to substract.
157 * @param [in] r The Color to substract
158 * @return A reference to this
160 public static Color operator -(Color l, Color r)
162 return new Color(l.R - r.R, l.G - r.G, l.B - r.B, l.A - r.A);
169 * @param [in] a The Color to multiply.
170 * @param [in] b The Color to multiply
171 * @return A reference to this
173 public static Color operator *(Color a, double b)
175 return new Color((int)(a.R * b), (int)(a.G * b), (int)(a.B * b), (int)(a.A * b));
182 * @param [in] a The Color to divide.
183 * @param [in] b The Color to divide
184 * @return float value of division operation
186 public static float operator /(Color a, Color b)
188 return (float)System.Math.Sqrt((a.R / b.R) * (a.G / b.G) * (a.B / b.B) * (a.A / b.A));
195 * @param [in] o The Color object to compare.
196 * @param [in] r The Color to add
197 * @return bool, whether object equal or not
199 public override bool Equals(object obj)
202 Color r = obj as Color;
207 return l.R == r.R && l.G == r.G && l.B == r.B && l.A == r.A;
214 * @return int, hascode of Color
216 public override int GetHashCode()
218 return base.GetHashCode();
225 * @return Color object
229 Color copy = new Color(R, G, B, A);