/*
* 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.
///
/// 3
public struct Size
{
///
/// Initializes a new instance of the with the specified values.
///
/// Width of the size.
/// Height of the size.
/// 3
public Size(int width, int height)
{
Width = width;
Height = height;
}
///
/// Gets or sets the width.
///
/// 3
public int Width
{
get;
set;
}
///
/// Gets or sets the height.
///
/// 3
public int Height
{
get;
set;
}
///
/// Returns a string that represents the current object.
///
/// A string that represents the current object.
/// 3
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 .
/// 3
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.
/// 3
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.
/// 3
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.
/// 3
public static bool operator !=(Size size1, Size size2)
{
return !(size1 == size2);
}
}
}