1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

SharedGraphics: Add some useful painting helpers and make use of them.

This commit is contained in:
Andreas Kling 2019-02-05 11:42:35 +01:00
parent b782055b96
commit 38f589a9cb
6 changed files with 38 additions and 22 deletions

View file

@ -67,6 +67,27 @@ public:
set_height(height() - h);
}
Rect shrunken(int w, int h)
{
Rect rect = *this;
rect.shrink(w, h);
return rect;
}
Rect inflated(int w, int h)
{
Rect rect = *this;
rect.inflate(w, h);
return rect;
}
Rect translated(int dx, int dy)
{
Rect rect = *this;
rect.move_by(dx, dy);
return rect;
}
bool contains(int x, int y) const
{
return x >= m_location.x() && x <= right() && y >= m_location.y() && y <= bottom();