pub struct ProjectiveTransform { /* private fields */ }Expand description
A projective mapping of a two-dimensional coordinate plane.
Implementations§
Source§impl ProjectiveTransform
impl ProjectiveTransform
Sourcepub fn translation(tx: f32, ty: f32) -> Self
pub fn translation(tx: f32, ty: f32) -> Self
Translates positions by the supplied logical-pixel offsets.
Sourcepub fn uniform_scale(scale: f32) -> Self
pub fn uniform_scale(scale: f32) -> Self
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]) -> Self
pub fn from_rect_to_quad(rect: Rect, quad: [[f32; 2]; 4]) -> Self
Maps a rectangle to corners ordered top-left, top-right, bottom-left, bottom-right.
Sourcepub fn from_homogeneous(matrix: [[f32; 3]; 3]) -> Self
pub fn from_homogeneous(matrix: [[f32; 3]; 3]) -> Self
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: Self) -> Self
pub fn then(self, next: Self) -> Self
Returns the composed transform that applies self first and next second.
Sourcepub fn inverse(self) -> Option<Self>
pub fn inverse(self) -> Option<Self>
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.