/*
* 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 point in the 2D space.
///
public struct Point
{
///
/// Initializes a new instance of the Point with the specified coordinates.
///
/// X-axis coordinate of the point in the 2D space.
/// Y-axis coordinate of the point in the 2D space.
public Point(int x, int y)
{
X = x;
Y = y;
}
///
/// Gets or sets the X-axis coordinate of the point in the 2D space.
///
public int X
{
get;
set;
}
///
/// Gets or sets the Y-axis coordinate of the point in the 2D space.
///
public int Y
{
get;
set;
}
///
/// Returns a string that represents the current object.
///
/// A string that represents the current object.
public override string ToString() => $"X={X.ToString()}, Y={Y.ToString()}";
///
/// Gets the hash code for this instance of .
///
/// The hash code for this instance of .
public override int GetHashCode()
{
return new { X, Y }.GetHashCode();
}
///
/// Compares an object to an instance of for equality.
///
/// A to compare.
/// true if the points are equal; otherwise, false.
public override bool Equals(object obj)
{
return obj is Point && this == (Point)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 ==(Point point1, Point point2)
{
return point1.X == point2.X && point1.Y == point2.Y;
}
///
/// 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 !=(Point point1, Point point2)
{
return !(point1 == point2);
}
}
}