2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 namespace Tizen.Multimedia
22 /// Represents a size in 2D space.
24 /// <since_tizen> 3 </since_tizen>
28 /// Initializes a new instance of the <see cref="Size"/> with the specified values.
30 /// <param name="width">Width of the size.</param>
31 /// <param name="height">Height of the size.</param>
32 /// <since_tizen> 3 </since_tizen>
33 public Size(int width, int height)
40 /// Gets or sets the width.
42 /// <since_tizen> 3 </since_tizen>
50 /// Gets or sets the height.
52 /// <since_tizen> 3 </since_tizen>
60 /// Returns a string that represents the current object.
62 /// <returns>A string that represents the current object.</returns>
63 /// <since_tizen> 3 </since_tizen>
64 public override string ToString() => $"Width={ Width.ToString() }, Height={ Height.ToString() }";
67 /// Gets the hash code for this instance of <see cref="Size"/>.
69 /// <returns>The hash code for this instance of <see cref="Size"/>.</returns>
70 /// <since_tizen> 3 </since_tizen>
71 public override int GetHashCode()
73 return new { Width, Height }.GetHashCode();
77 /// Compares an object to an instance of <see cref="Size"/> for equality.
79 /// <param name="obj">A <see cref="Object"/> to compare.</param>
80 /// <returns>true if the two sizes are equal; otherwise, false.</returns>
81 /// <since_tizen> 3 </since_tizen>
82 public override bool Equals(object obj)
84 return obj is Size && this == (Size)obj;
88 /// Compares two instances of <see cref="Size"/> for equality.
90 /// <param name="size1">A <see cref="Size"/> to compare.</param>
91 /// <param name="size2">A <see cref="Size"/> to compare.</param>
92 /// <returns>true if the two instances of <see cref="Size"/> are equal; otherwise false.</returns>
93 /// <since_tizen> 3 </since_tizen>
94 public static bool operator ==(Size size1, Size size2)
96 return size1.Width == size2.Width && size1.Height == size2.Height;
100 /// Compares two instances of <see cref="Size"/> for inequality.
102 /// <param name="size1">A <see cref="Size"/> to compare.</param>
103 /// <param name="size2">A <see cref="Size"/> to compare.</param>
104 /// <returns>true if the two instances of <see cref="Size"/> are not equal; otherwise false.</returns>
105 /// <since_tizen> 3 </since_tizen>
106 public static bool operator !=(Size size1, Size size2)
108 return !(size1 == size2);