/* * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace Tizen.Multimedia { /// /// Represents a size in 2D space. /// public struct Size { /// /// Initializes a new instance of the Size with the specified values. /// /// Width of the size. /// Height of the size. public Size(int width, int height) { Width = width; Height = height; } /// /// Gets or sets the width of the Size. /// public int Width { get; set; } /// /// Gets or sets the height of the Size. /// public int Height { get; set; } /// /// Returns a string that represents the current object. /// /// A string that represents the current object. public override string ToString() => $"Width={ Width.ToString() }, Height={ Height.ToString() }"; /// /// Gets the hash code for this instance of . /// /// The hash code for this instance of . public override int GetHashCode() { return new { Width, Height }.GetHashCode(); } /// /// Compares an object to an instance of for equality. /// /// A to compare. /// true if the two sizes are equal; otherwise, false. public override bool Equals(object obj) { return obj is Size && this == (Size)obj; } /// /// Compares two instances of for equality. /// /// A to compare. /// A to compare. /// true if the two instances of are equal; otherwise false. public static bool operator ==(Size size1, Size size2) { return size1.Width == size2.Width && size1.Height == size2.Height; } /// /// Compares two instances of for inequality. /// /// A to compare. /// A to compare. /// true if the two instances of are not equal; otherwise false. public static bool operator !=(Size size1, Size size2) { return !(size1 == size2); } } }