mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibGfx: Add Gfx::extract_2d_affine_transform(Matrix4x4) helper
This commit is contained in:
parent
da00a5cdb5
commit
848b0d9c81
Notes:
sideshowbarker
2024-07-17 06:28:38 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/848b0d9c81 Pull-request: https://github.com/SerenityOS/serenity/pull/21977 Reviewed-by: https://github.com/timschumi
1 changed files with 8 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Math.h>
|
||||
#include <LibGfx/AffineTransform.h>
|
||||
#include <LibGfx/Matrix.h>
|
||||
#include <LibGfx/Vector3.h>
|
||||
#include <LibGfx/Vector4.h>
|
||||
|
@ -76,6 +77,13 @@ constexpr static Matrix4x4<T> rotation_matrix(Vector3<T> const& axis, T angle)
|
|||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Gfx::AffineTransform extract_2d_affine_transform(Matrix4x4<T> const& matrix)
|
||||
{
|
||||
auto* m = matrix.elements();
|
||||
return Gfx::AffineTransform(m[0][0], m[1][0], m[0][1], m[1][1], m[0][3], m[1][3]);
|
||||
}
|
||||
|
||||
typedef Matrix4x4<float> FloatMatrix4x4;
|
||||
typedef Matrix4x4<double> DoubleMatrix4x4;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue