#[repr(C)]pub struct ComputedTransform3D {
pub m: [[f32; 4]; 4],
}Expand description
A computed 4x4 transformation matrix in pixel space.
Represents the final transformation matrix for a DOM element after applying all CSS transform functions (translate, rotate, scale, etc.) and accounting for transform-origin.
§Memory Layout
Matrix is stored in row-major format:
m[0] = [m11, m12, m13, m14]
m[1] = [m21, m22, m23, m24]
m[2] = [m31, m32, m33, m34]
m[3] = [m41, m42, m43, m44]Fields§
§m: [[f32; 4]; 4]The 4x4 matrix in row-major format
Implementations§
Source§impl ComputedTransform3D
impl ComputedTransform3D
Sourcepub const fn new(
m11: f32,
m12: f32,
m13: f32,
m14: f32,
m21: f32,
m22: f32,
m23: f32,
m24: f32,
m31: f32,
m32: f32,
m33: f32,
m34: f32,
m41: f32,
m42: f32,
m43: f32,
m44: f32,
) -> Self
pub const fn new( m11: f32, m12: f32, m13: f32, m14: f32, m21: f32, m22: f32, m23: f32, m24: f32, m31: f32, m32: f32, m33: f32, m34: f32, m41: f32, m42: f32, m43: f32, m44: f32, ) -> Self
Creates a new 4x4 transformation matrix with the given elements.
Elements are specified in row-major order (m11, m12, …, m44).
Sourcepub const fn new_2d(
m11: f32,
m12: f32,
m21: f32,
m22: f32,
m41: f32,
m42: f32,
) -> Self
pub const fn new_2d( m11: f32, m12: f32, m21: f32, m22: f32, m41: f32, m42: f32, ) -> Self
Creates a 2D transformation matrix (3D matrix with Z = 0).
This is equivalent to the CSS matrix() function. The transformation
only affects the X and Y axes.
Corresponds to matrix(m11, m12, m21, m22, m41, m42) in CSS.
Sourcepub fn inverse(&self) -> Self
pub fn inverse(&self) -> Self
Computes the inverse of this transformation matrix.
This function uses a standard matrix inversion algorithm. Returns the identity matrix if the determinant is zero (singular matrix).
NOTE: This is a relatively expensive operation.
pub fn from_style_transform_vec( t_vec: &[StyleTransform], transform_origin: &StyleTransformOrigin, percent_resolve_x: f32, percent_resolve_y: f32, rotation_mode: RotationMode, ) -> Self
Sourcepub fn from_style_transform(
t: &StyleTransform,
transform_origin: &StyleTransformOrigin,
percent_resolve_x: f32,
percent_resolve_y: f32,
rotation_mode: RotationMode,
) -> Self
pub fn from_style_transform( t: &StyleTransform, transform_origin: &StyleTransformOrigin, percent_resolve_x: f32, percent_resolve_y: f32, rotation_mode: RotationMode, ) -> Self
Creates a new transform from a style transform using the parent width as a way to resolve for percentages
pub const fn new_scale(x: f32, y: f32, z: f32) -> Self
pub const fn new_translation(x: f32, y: f32, z: f32) -> Self
pub fn new_perspective(d: f32) -> Self
Sourcepub fn new_rotation(x: f32, y: f32, z: f32, theta_radians: f32) -> Self
pub fn new_rotation(x: f32, y: f32, z: f32, theta_radians: f32) -> Self
Create a 3d rotation transform from an angle / axis. The supplied axis must be normalized.
pub fn new_skew(alpha: f32, beta: f32) -> Self
pub fn get_column_major(&self) -> Self
pub fn transform_point2d(&self, p: LogicalPosition) -> Option<LogicalPosition>
pub fn scale_for_dpi(&mut self, scale_factor: f32)
Sourcepub fn then(&self, other: &Self) -> Self
pub fn then(&self, other: &Self) -> Self
Computes the sum of two matrices while applying other AFTER the current matrix.
pub unsafe fn then_sse(&self, other: &Self) -> Self
pub unsafe fn linear_combine_avx8( a01: __m256, b: &ComputedTransform3D, ) -> __m256
pub unsafe fn then_avx8(&self, other: &Self) -> Self
pub fn make_rotation( rotation_origin: (f32, f32), degrees: f32, axis_x: f32, axis_y: f32, axis_z: f32, rotation_mode: RotationMode, ) -> Self
Trait Implementations§
Source§impl Clone for ComputedTransform3D
impl Clone for ComputedTransform3D
Source§fn clone(&self) -> ComputedTransform3D
fn clone(&self) -> ComputedTransform3D
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ComputedTransform3D
impl Debug for ComputedTransform3D
Source§impl PartialEq for ComputedTransform3D
impl PartialEq for ComputedTransform3D
Source§impl PartialOrd for ComputedTransform3D
impl PartialOrd for ComputedTransform3D
impl Copy for ComputedTransform3D
impl StructuralPartialEq for ComputedTransform3D
Auto Trait Implementations§
impl Freeze for ComputedTransform3D
impl RefUnwindSafe for ComputedTransform3D
impl Send for ComputedTransform3D
impl Sync for ComputedTransform3D
impl Unpin for ComputedTransform3D
impl UnwindSafe for ComputedTransform3D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more