Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace System.Drawing
- {
- public struct PointM
- {
- public decimal X { get; }
- public decimal Y { get; }
- public bool IsEmpty { get; }
- public PointM(decimal X, decimal Y)
- {
- this.X = X;
- this.Y = Y;
- IsEmpty = X == 0m && Y == 0m;
- }
- public static PointM Add(PointM Point, Size Size) => Point + Size;
- public static PointM Add(PointM Point, SizeM Size) => Point + Size;
- public override bool Equals(object Point) => Point.GetType() == GetType() && ((PointM)Point).X == X && ((PointM)Point).Y == Y;
- public override int GetHashCode() => X.GetHashCode() ^ Y.GetHashCode();
- public static PointM Subtract(PointM Point, Size Size) => Point - Size;
- public static PointM Subtract(PointM Point, SizeM Size) => Point - Size;
- public static PointM operator +(PointM Point, SizeM Size) => new PointM(Point.X + Size.Width, Point.Y + Size.Height);
- public static PointM operator +(PointM Point, Size Size) => new PointM(Point.X + Size.Width, Point.Y + Size.Height);
- public static bool operator ==(PointM Point1, PointM Point2) => Point1.X == Point2.X && Point1.Y == Point2.Y;
- public static bool operator !=(PointM Point1, PointM Point2) => !(Point1 == Point2);
- public static PointM operator -(PointM Point, SizeM Size) => new PointM(Point.X - Size.Width, Point.Y - Size.Height);
- public static PointM operator -(PointM Point, Size Size) => new PointM(Point.X - Size.Width, Point.Y - Size.Height);
- public override string ToString() => "{ X:" + X + ", Y:" + Y + " }";
- }
- public struct SizeM
- {
- public decimal Width { get; }
- public decimal Height { get; }
- public bool IsEmpty { get; }
- public SizeM(PointM Point)
- {
- Width = Point.X;
- Height = Point.Y;
- IsEmpty = Width == 0m && Height == 0m;
- }
- public SizeM(SizeM Size)
- {
- Width = Size.Width;
- Height = Size.Height;
- IsEmpty = Width == 0m && Height == 0m;
- }
- public SizeM(decimal Width, decimal Height)
- {
- this.Width = Width;
- this.Height = Height;
- IsEmpty = Width == 0m && Height == 0m;
- }
- public static SizeM Add(SizeM Size1, SizeM Size2) => Size1 + Size2;
- public override bool Equals(object Size) => Size.GetType() == GetType() && ((SizeM)Size).Width == Width && ((SizeM)Size).Height == Height;
- public override int GetHashCode() => Width.GetHashCode() ^ Height.GetHashCode();
- public static SizeM Subtract(SizeM Size1, SizeM Size2) => Size1 - Size2;
- public PointM ToPointM() => (PointM)this;
- public Size ToSize() => (Size)this;
- public override string ToString() => "{ Width:" + Width + ", Height:" + Height + " }";
- public static explicit operator Size(SizeM Size) => new Size((int)Size.Width, (int)Size.Height);
- public static SizeM operator +(SizeM Size1, SizeM Size2) => new SizeM(Size1.Width + Size2.Width, Size1.Height + Size2.Height);
- public static SizeM operator -(SizeM Size1, SizeM Size2) => new SizeM(Size1.Width - Size2.Width, Size1.Height - Size2.Height);
- public static explicit operator PointM(SizeM Size) => new PointM(Size.Width, Size.Height);
- public static bool operator ==(SizeM Size1, SizeM Size2) => Size1.Width == Size2.Width && Size1.Height == Size2.Height;
- public static bool operator !=(SizeM Size1, SizeM Size2) => !(Size1 == Size2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment