From d9f1b72067248976b3dc00169ca54c574cc91302 Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 23 Mar 2013 11:09:56 +0000 Subject: [PATCH] Added method AffineTransform::withAbsoluteTranslation --- modules/juce_graphics/geometry/juce_AffineTransform.cpp | 6 ++++++ modules/juce_graphics/geometry/juce_AffineTransform.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/modules/juce_graphics/geometry/juce_AffineTransform.cpp b/modules/juce_graphics/geometry/juce_AffineTransform.cpp index 8cdfd28e5e..ba3f31882d 100644 --- a/modules/juce_graphics/geometry/juce_AffineTransform.cpp +++ b/modules/juce_graphics/geometry/juce_AffineTransform.cpp @@ -105,6 +105,12 @@ AffineTransform AffineTransform::translation (const float dx, const float dy) no 0, 1.0f, dy); } +AffineTransform AffineTransform::withAbsoluteTranslation (const float tx, const float ty) const noexcept +{ + return AffineTransform (mat00, mat01, tx, + mat10, mat11, ty); +} + AffineTransform AffineTransform::rotated (const float rad) const noexcept { const float cosRad = std::cos (rad); diff --git a/modules/juce_graphics/geometry/juce_AffineTransform.h b/modules/juce_graphics/geometry/juce_AffineTransform.h index f9556d5f6c..c937b7cb72 100644 --- a/modules/juce_graphics/geometry/juce_AffineTransform.h +++ b/modules/juce_graphics/geometry/juce_AffineTransform.h @@ -133,6 +133,10 @@ public: static AffineTransform translation (float deltaX, float deltaY) noexcept; + /** Returns a copy of this transform with the specified translation matrix values. */ + AffineTransform withAbsoluteTranslation (float translationX, + float translationY) const noexcept; + /** Returns a transform which is the same as this one followed by a rotation. The rotation is specified by a number of radians to rotate clockwise, centred around