public static readonly RectangleF Empty;
+#if TARGET_JVM
+ internal java.awt.geom.Rectangle2D NativeObject {
+ get {
+ return new java.awt.geom.Rectangle2D.Float(X,Y,Width,Height);
+ }
+ }
+#endif
/// <summary>
/// FromLTRB Shared Method
public void Inflate (float width, float height)
{
- x -= width;
- y -= height;
- width += width * 2;
- height += height * 2;
+ Inflate (new SizeF (width, height));
}
/// <summary>
public void Inflate (SizeF sz)
{
- Inflate (sz.Width, sz.Height);
+ x -= sz.Width;
+ y -= sz.Height;
+ width += sz.Width * 2;
+ height += sz.Height * 2;
}
/// <summary>
public static RectangleF Intersect (RectangleF r1,
RectangleF r2)
{
- RectangleF r = new RectangleF (r1.X, r1.Y, r1.Width, r1.Height);
- r.Intersect (r2);
- return r;
+ if (!r1.IntersectsWith (r2))
+ return Empty;
+
+ return FromLTRB (
+ Math.Max (r1.Left, r2.Left),
+ Math.Max (r1.Top, r2.Top),
+ Math.Min (r1.Right, r2.Right),
+ Math.Min (r1.Bottom, r2.Bottom));
}
/// <summary>
public void Intersect (RectangleF r)
{
- if (!IntersectsWith (r)) {
- x = 0;
- y = 0;
- width = 0;
- height = 0;
- }
-
- x = Math.Max (Left, r.Left);
- y = Math.Max (Top, r.Top);
- width = Math.Min (Right, r.Right) - X;
- height = Math.Min (Bottom, r.Bottom) - Y;
+ this = RectangleF.Intersect (this, r);
}
/// <summary>
}
+#if TARGET_JVM
+ internal RectangleF (java.awt.geom.RectangularShape r2d) {
+ this.x = (float) r2d.getX ();
+ this.y = (float) r2d.getY ();
+ this.width = (float) r2d.getWidth ();
+ this.height = (float) r2d.getHeight ();
+ }
+#endif
/// <summary>
/// Bottom Property