aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/Matrix.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform/Matrix.hpp')
-rw-r--r--include/cru/platform/Matrix.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/cru/platform/Matrix.hpp b/include/cru/platform/Matrix.hpp
index 72459b79..47917d47 100644
--- a/include/cru/platform/Matrix.hpp
+++ b/include/cru/platform/Matrix.hpp
@@ -43,6 +43,15 @@ struct Matrix {
point.x * m12 + point.y * m22 + m32};
}
+ Rect TransformRect(const Rect& rect, bool normalize = true) const {
+ Point lefttop = TransformPoint(rect.GetLeftTop()),
+ rightbottom = TransformPoint(rect.GetRightBottom());
+ auto result =
+ Rect::FromVertices(lefttop.x, lefttop.y, rightbottom.x, rightbottom.y);
+ if (normalize) result = result.Normalize();
+ return result;
+ }
+
static Matrix Identity() {
return Matrix{1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f};
}