Skip to main content

rust_css_parser/ast/transform/
mod.rs

1//! Port of `src/ast/transform/*`: the matrices of the transform functions. A matrix is `[f64; 16]` in
2//! column-major order (`type.d.ts`); the operations write into matrices provided by the caller.
3
4pub mod compute;
5pub mod matrix;
6pub mod minify;
7pub mod perspective;
8pub mod rotate;
9pub mod scale;
10pub mod skew;
11pub mod translate;
12pub mod utils;
13
14/// 4x4 matrix, column-major order
15pub type Matrix = [f64; 16];
16
17/// decomposition of a 3d matrix: translate → rotate → skew → scale (`DecomposedMatrix3D`)
18#[derive(Clone, Copy, Debug, Default)]
19pub struct DecomposedMatrix3D {
20    pub translate_x: f64,
21    pub translate_y: f64,
22    pub translate_z: f64,
23    pub scale_x: f64,
24    pub scale_y: f64,
25    pub scale_z: f64,
26    pub skew_xy: f64,
27    pub skew_xz: f64,
28    pub skew_yz: f64,
29    /// rotation axis
30    pub rotate_x: f64,
31    pub rotate_y: f64,
32    pub rotate_z: f64,
33    /// rotation angle in degrees
34    pub rotate_angle: f64,
35    pub perspective_x: f64,
36    pub perspective_y: f64,
37    pub perspective_z: f64,
38    pub perspective_w: f64,
39}