00001 #region License
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #endregion
00027
00028 using System;
00029 using System.Collections.Generic;
00030 using System.Text;
00031
00032 namespace OpenTK
00033 {
00034 #if NO_SYSDRAWING
00038 public struct Point : IEquatable<Point>
00039 {
00040 #region Fields
00041
00042 int x, y;
00043
00044 #endregion
00045
00046 #region Constructors
00047
00053 public Point(int x, int y)
00054 : this()
00055 {
00056 X = x;
00057 Y = y;
00058 }
00059
00060 #endregion
00061
00062 #region Public Members
00063
00067 public bool IsEmpty { get { return X == 0 && Y == 0; } }
00068
00072 public int X { get { return x; } set { x = value; } }
00073
00077 public int Y { get { return y; } set { y = value; } }
00078
00082 public static readonly Point Zero = new Point();
00083
00087 public static readonly Point Empty = new Point();
00088
00101 public static Point operator +(Point point, Size size)
00102 {
00103 return new Point(point.X + size.Width, point.Y + size.Height);
00104 }
00105
00118 public static Point operator -(Point point, Size size)
00119 {
00120 return new Point(point.X - size.Width, point.Y - size.Height);
00121 }
00122
00129 public static bool operator ==(Point left, Point right)
00130 {
00131 return left.Equals(right);
00132 }
00133
00140 public static bool operator !=(Point left, Point right)
00141 {
00142 return !left.Equals(right);
00143 }
00144
00154 public static implicit operator System.Drawing.Point(Point point)
00155 {
00156 return new System.Drawing.Point(point.X, point.Y);
00157 }
00158
00168 public static implicit operator Point(System.Drawing.Point point)
00169 {
00170 return new Point(point.X, point.Y);
00171 }
00172
00182 public static implicit operator System.Drawing.PointF(Point point)
00183 {
00184 return new System.Drawing.PointF(point.X, point.Y);
00185 }
00186
00192 public override bool Equals(object obj)
00193 {
00194 if (obj is Point)
00195 return Equals((Point)obj);
00196
00197 return false;
00198 }
00199
00204 public override int GetHashCode()
00205 {
00206 return X.GetHashCode() ^ Y.GetHashCode();
00207 }
00208
00213 public override string ToString()
00214 {
00215 return String.Format("{{{0}, {1}}}", X, Y);
00216 }
00217
00218 #endregion
00219
00220 #region IEquatable<Point> Members
00221
00227 public bool Equals(Point other)
00228 {
00229 return X == other.X && Y == other.Y;
00230 }
00231
00232 #endregion
00233 }
00234 #endif
00235 }