Skip to main content

MatrixHelpers

Trait MatrixHelpers 

Source
pub trait MatrixHelpers<Src, Dst> {
Show 13 methods // Required methods fn preserves_2d_axis_alignment(&self) -> bool; fn has_perspective_component(&self) -> bool; fn coplanar_scale_factors(&self) -> Option<(f32, f32)>; fn has_2d_inverse(&self) -> bool; fn exceeds_2d_scale(&self, limit: f64) -> bool; fn inverse_project( &self, target: &Point2D<f32, Dst>, ) -> Option<Point2D<f32, Src>>; fn inverse_rect_footprint( &self, rect: &Box2D<f32, Dst>, ) -> Option<Box2D<f32, Src>>; fn is_simple_translation(&self) -> bool; fn is_simple_2d_translation(&self) -> bool; fn is_2d_scale_translation(&self) -> bool; fn determinant_2d(&self) -> f32; fn flatten_z_output(&mut self); fn cast_unit<NewSrc, NewDst>(&self) -> Transform3D<f32, NewSrc, NewDst>;
}

Required Methods§

Source

fn preserves_2d_axis_alignment(&self) -> bool

A port of the preserves2dAxisAlignment function in Skia. Defined in the SkMatrix44 class.

Source

fn has_perspective_component(&self) -> bool

Source

fn coplanar_scale_factors(&self) -> Option<(f32, f32)>

Scale factors for content that is coplanar in the source space (z=0), which is the case for the contents of a picture surface. Returns None if the perspective divide varies across that plane, where no single scale factor is correct.

Much weaker than is_2d_on_z_plane: this only asks how the plane is mapped, not that mapping it back through inverse() agrees, so a constant w != 1 is fine (it divides out) and the z terms don’t matter at all.

Source

fn has_2d_inverse(&self) -> bool

Source

fn exceeds_2d_scale(&self, limit: f64) -> bool

Check if the matrix post-scaling on either the X or Y axes could cause geometry transformed by this matrix to have scaling exceeding the supplied limit.

Source

fn inverse_project( &self, target: &Point2D<f32, Dst>, ) -> Option<Point2D<f32, Src>>

Source

fn inverse_rect_footprint( &self, rect: &Box2D<f32, Dst>, ) -> Option<Box2D<f32, Src>>

Source

fn is_simple_translation(&self) -> bool

Source

fn is_simple_2d_translation(&self) -> bool

Source

fn is_2d_scale_translation(&self) -> bool

Source

fn determinant_2d(&self) -> f32

Return the determinant of the 2D part of the matrix.

Source

fn flatten_z_output(&mut self)

Turn Z transformation into identity. This is useful when crossing “flat” transform styled stacking contexts upon traversing the coordinate systems.

Source

fn cast_unit<NewSrc, NewDst>(&self) -> Transform3D<f32, NewSrc, NewDst>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<Src, Dst> MatrixHelpers<Src, Dst> for Transform3D<f32, Src, Dst>

Source§

fn inverse_project( &self, target: &Point2D<f32, Dst>, ) -> Option<Point2D<f32, Src>>

Find out a point in Src that would be projected into the target.

Source§

fn preserves_2d_axis_alignment(&self) -> bool

Source§

fn has_perspective_component(&self) -> bool

Source§

fn coplanar_scale_factors(&self) -> Option<(f32, f32)>

Source§

fn has_2d_inverse(&self) -> bool

Source§

fn exceeds_2d_scale(&self, limit: f64) -> bool

Source§

fn inverse_rect_footprint( &self, rect: &Box2D<f32, Dst>, ) -> Option<Box2D<f32, Src>>

Source§

fn is_simple_translation(&self) -> bool

Source§

fn is_simple_2d_translation(&self) -> bool

Source§

fn is_2d_scale_translation(&self) -> bool

Source§

fn determinant_2d(&self) -> f32

Source§

fn flatten_z_output(&mut self)

Source§

fn cast_unit<NewSrc, NewDst>(&self) -> Transform3D<f32, NewSrc, NewDst>

Implementors§