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