#[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 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.
Sourcepub fn from_style_transform_vec(
t_vec: &[StyleTransform],
transform_origin: &StyleTransformOrigin,
percent_resolve_x: f32,
percent_resolve_y: f32,
rotation_mode: RotationMode,
) -> Self
pub fn from_style_transform_vec( t_vec: &[StyleTransform], transform_origin: &StyleTransformOrigin, percent_resolve_x: f32, percent_resolve_y: f32, rotation_mode: RotationMode, ) -> Self
Computes the matrix of a rect from a &[StyleTransform].
Sourcepub const fn new_scale(x: f32, y: f32, z: f32) -> Self
pub const fn new_scale(x: f32, y: f32, z: f32) -> Self
Creates a scaling matrix with independent scale factors per axis.
Sourcepub const fn new_translation(x: f32, y: f32, z: f32) -> Self
pub const fn new_translation(x: f32, y: f32, z: f32) -> Self
Creates a translation matrix that moves by (x, y, z).
Sourcepub fn transform_point2d(&self, p: LogicalPosition) -> Option<LogicalPosition>
pub fn transform_point2d(&self, p: LogicalPosition) -> Option<LogicalPosition>
Transforms a 2D point into the target coordinate space.
Sourcepub fn scale_for_dpi(&mut self, scale_factor: f32)
pub fn scale_for_dpi(&mut self, scale_factor: f32)
Scales the translation components of this matrix by scale_factor for DPI adjustment.
Trait Implementations§
Source§impl Clone for ComputedTransform3D
impl Clone for ComputedTransform3D
Source§fn clone(&self) -> ComputedTransform3D
fn clone(&self) -> ComputedTransform3D
1.0.0 (const: unstable) · 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§fn eq(&self, other: &ComputedTransform3D) -> bool
fn eq(&self, other: &ComputedTransform3D) -> bool
self and other values to be equal, and is used by ==.