Merge "Stop copying Property::Maps in ImageView SetProperty" into devel/master
[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 Width value .
13    * @param [in] b Height value.
14    */
15           public Size(float a, float b)
16               : base(a, b)
17            {
18            }
19   /**
20    * @brief default constructor
21    *
22    * @since 1.0.0
23    */
24           public Size()
25               : base()
26            {
27            }   
28
29   /**
30    * @brief constructor with base class object
31    *
32    * @since 1.0.0
33    * @param [in] o The Vector2 with Width, Height values.
34    */
35           public Size(Vector2 o)
36                : base(o.x, o.y)
37           {
38                  
39           }
40
41   /**
42    * @brief Copy constructor
43    *
44    * @since 1.0.0
45    * @param [in] o The Size having Width & Y.
46    */
47           public Size(Size a)
48               : base(a.width, a.height)
49            {
50            }
51
52   ///< name "W", type float (Size Width 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 Height 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 substract.
86    * @param [in] r The Size to substract
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] a The Size to multiply
99    * @param [in] b The Size to multiply
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] a The Size to divide.
112    * @param [in] b The Size to divide
113    * @return float of the size division
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] obj The Size object to compare.
125    * @return bool, whether object equal or not
126    */
127            public override bool Equals(object obj)
128            {
129                Size that = obj as Size;
130                if (that == null)
131                {
132                    return false;
133                }
134                return this.W == that.W && this.H == that.H;
135            }
136
137   /**
138    * @brief GetHashCode
139    *
140    * @since 1.0.0
141    * @return int, hascode of Size
142    */
143            public override int GetHashCode()
144            {
145                return (int)(W + H);
146            }
147
148   /**
149    * @brief Clone
150    *
151    * @since 1.0.0
152    * @return returns a copy of Size object
153    */
154            public Size Clone()
155            {
156                Size copy = new Size(W, H);
157                return copy;
158            }
159        }
160 }