diff --git a/Userland/Libraries/LibGfx/Rect.h b/Userland/Libraries/LibGfx/Rect.h index 9b4138d12a..77e58a827d 100644 --- a/Userland/Libraries/LibGfx/Rect.h +++ b/Userland/Libraries/LibGfx/Rect.h @@ -422,6 +422,11 @@ public: void intersect(const Rect&); + static Rect centered_on(const Point& center, const Size& size) + { + return { { center.x() - size.width() / 2, center.y() - size.height() / 2 }, size }; + } + static Rect from_two_points(const Point& a, const Point& b) { return { min(a.x(), b.x()), min(a.y(), b.y()), abst(a.x() - b.x()), abst(a.y() - b.y()) };