mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-18 00:54:19 +00:00
Added a new AffineTransform::scaled method and improved Rectangle::operator*=
This commit is contained in:
parent
7590e3f1fe
commit
7d167aef87
3 changed files with 15 additions and 3 deletions
|
|
@ -152,6 +152,12 @@ AffineTransform AffineTransform::scaled (const float factorX, const float factor
|
|||
factorY * mat10, factorY * mat11, factorY * mat12);
|
||||
}
|
||||
|
||||
AffineTransform AffineTransform::scaled (const float factor) const noexcept
|
||||
{
|
||||
return AffineTransform (factor * mat00, factor * mat01, factor * mat02,
|
||||
factor * mat10, factor * mat11, factor * mat12);
|
||||
}
|
||||
|
||||
AffineTransform AffineTransform::scale (const float factorX, const float factorY) noexcept
|
||||
{
|
||||
return AffineTransform (factorX, 0, 0, 0, factorY, 0);
|
||||
|
|
|
|||
|
|
@ -165,6 +165,11 @@ public:
|
|||
AffineTransform scaled (float factorX,
|
||||
float factorY) const noexcept;
|
||||
|
||||
/** Returns a transform which is the same as this one followed by a re-scaling.
|
||||
The scaling is centred around the origin (0, 0).
|
||||
*/
|
||||
AffineTransform scaled (float factor) const noexcept;
|
||||
|
||||
/** Returns a transform which is the same as this one followed by a re-scaling.
|
||||
The scaling is centred around the origin provided.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -304,9 +304,10 @@ public:
|
|||
template <typename FloatType>
|
||||
Rectangle operator*= (FloatType scaleFactor) noexcept
|
||||
{
|
||||
pos *= scaleFactor;
|
||||
w = (ValueType) (w * scaleFactor);
|
||||
h = (ValueType) (h * scaleFactor);
|
||||
Rectangle<FloatType> (pos.x * scaleFactor,
|
||||
pos.y * scaleFactor,
|
||||
w * scaleFactor,
|
||||
h * scaleFactor).copyWithRounding (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue