aboutsummaryrefslogtreecommitdiffstatsci
path: root/Drawing2D
diff options
context:
space:
mode:
Diffstat (limited to 'Drawing2D')
-rw-r--r--Drawing2D/src/Rectangle.cs7
-rw-r--r--Drawing2D/src/Size.cs3
2 files changed, 10 insertions, 0 deletions
diff --git a/Drawing2D/src/Rectangle.cs b/Drawing2D/src/Rectangle.cs
index d120de69..a959b555 100644
--- a/Drawing2D/src/Rectangle.cs
+++ b/Drawing2D/src/Rectangle.cs
@@ -72,6 +72,13 @@ namespace Drawing2D {
this.Y -= yDelta;
this.Height += 2 * yDelta;
}
+ public void Inflate(Size delta)
+ {
+ this.X -= delta.Width;
+ this.Width += 2 * delta.Width;
+ this.Y -= delta.Height;
+ this.Height += 2 * delta.Height;
+ }
public void Inflate(int delta)
{
Inflate (delta, delta);
diff --git a/Drawing2D/src/Size.cs b/Drawing2D/src/Size.cs
index dd3a6c1b..4fdf0cd5 100644
--- a/Drawing2D/src/Size.cs
+++ b/Drawing2D/src/Size.cs
@@ -44,8 +44,11 @@ namespace Drawing2D
public static bool operator != (Size s, int i) => (s.Width != i || s.Height != i);*/
public static Size operator + (Size s1, Size s2) => new Size (s1.Width + s2.Width, s1.Height + s2.Height);
public static Size operator + (Size s, int i) => new Size (s.Width + i, s.Height + i);
+ public static Size operator - (Size s1, Size s2) => new Size (s1.Width - s2.Width, s1.Height - s2.Height);
+ public static Size operator - (Size s, int i) => new Size (s.Width - i, s.Height - i);
public static Size operator * (Size s, int i) => new Size (s.Width * i, s.Height * i);
public static Size operator / (Size s, int i) => new Size (s.Width / i, s.Height / i);
+ public static Size operator -(Size s) => new Size (-s.Width, -s.Height);
public static Size operator * (Size s, double i) => new Size ((int)(s.Width * i), (int)(s.Height * i));
#endregion