LibGfx: Add AffineTransform::skew_radians()

This commit is contained in:
MacDue 2023-04-09 18:31:00 +01:00 committed by Andreas Kling
parent 790daa4754
commit b8d1fae31f
Notes: sideshowbarker 2024-07-16 21:45:42 +09:00
2 changed files with 8 additions and 0 deletions

View File

@ -79,6 +79,13 @@ AffineTransform& AffineTransform::set_scale(FloatPoint s)
return set_scale(s.x(), s.y());
}
AffineTransform& AffineTransform::skew_radians(float x_radians, float y_radians)
{
AffineTransform skew_transform(1, AK::tan(y_radians), AK::tan(x_radians), 1, 0, 0);
multiply(skew_transform);
return *this;
}
AffineTransform& AffineTransform::translate(float tx, float ty)
{
m_values[4] += tx * m_values[0] + ty * m_values[2];

View File

@ -64,6 +64,7 @@ public:
AffineTransform& set_translation(float tx, float ty);
AffineTransform& set_translation(FloatPoint t);
AffineTransform& rotate_radians(float);
AffineTransform& skew_radians(float x_radians, float y_radians);
AffineTransform& multiply(AffineTransform const&);
Optional<AffineTransform> inverse() const;