pub struct ProjectiveTransform { /* private fields */ }Expand description
A projective mapping of a two-dimensional coordinate plane.
Implementations§
Source§impl ProjectiveTransform
impl ProjectiveTransform
Sourcepub const fn identity() -> ProjectiveTransform
pub const fn identity() -> ProjectiveTransform
Leaves positions unchanged.
Sourcepub fn translation(tx: f32, ty: f32) -> ProjectiveTransform
pub fn translation(tx: f32, ty: f32) -> ProjectiveTransform
Translates positions by the supplied logical-pixel offsets.
Sourcepub fn uniform_scale(scale: f32) -> ProjectiveTransform
pub fn uniform_scale(scale: f32) -> ProjectiveTransform
Uniform scale about the origin (device-scale root transform: render graphs stay in logical dp; density applies at execution).
Sourcepub fn from_rect_to_quad(rect: Rect, quad: [[f32; 2]; 4]) -> ProjectiveTransform
pub fn from_rect_to_quad(rect: Rect, quad: [[f32; 2]; 4]) -> ProjectiveTransform
Maps a rectangle to corners ordered top-left, top-right, bottom-left, bottom-right.
Sourcepub fn from_homogeneous(matrix: [[f32; 3]; 3]) -> ProjectiveTransform
pub fn from_homogeneous(matrix: [[f32; 3]; 3]) -> ProjectiveTransform
The transform a homogeneous matrix describes, scaled so its last entry is one wherever that entry is not zero: its other entries then read as the scale, turn, translation and perspective they are.
Sourcepub fn then(self, next: ProjectiveTransform) -> ProjectiveTransform
pub fn then(self, next: ProjectiveTransform) -> ProjectiveTransform
Returns the composed transform that applies self first and next second.
Sourcepub fn inverse(self) -> Option<ProjectiveTransform>
pub fn inverse(self) -> Option<ProjectiveTransform>
Maps destination coordinates back to the source, unless the matrix is singular.
Sourcepub fn map_rect(self, rect: Rect) -> [[f32; 2]; 4]
pub fn map_rect(self, rect: Rect) -> [[f32; 2]; 4]
Maps a rectangle’s top-left, top-right, bottom-left and bottom-right corners.
Sourcepub fn bounds_for_rect(self, rect: Rect) -> Rect
pub fn bounds_for_rect(self, rect: Rect) -> Rect
Returns the axis-aligned bounds of the transformed rectangle.
Trait Implementations§
Source§impl Clone for ProjectiveTransform
impl Clone for ProjectiveTransform
Source§fn clone(&self) -> ProjectiveTransform
fn clone(&self) -> ProjectiveTransform
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more