pub struct Transform {
pub sx: f32,
pub ky: f32,
pub kx: f32,
pub sy: f32,
pub tx: f32,
pub ty: f32,
}Expand description
A 2×3 affine transformation.
A point (x, y) maps to
(sx*x + kx*y + tx, ky*x + sy*y + ty). The order of the fields matches
Skia (column-major).
Fields§
§sx: f32§ky: f32§kx: f32§sy: f32§tx: f32§ty: f32Implementations§
Source§impl Transform
impl Transform
pub const fn identity() -> Transform
pub const fn from_row( sx: f32, ky: f32, kx: f32, sy: f32, tx: f32, ty: f32, ) -> Transform
pub const fn from_translate(tx: f32, ty: f32) -> Transform
pub const fn from_scale(sx: f32, sy: f32) -> Transform
Sourcepub fn from_rotate(degrees: f32) -> Transform
pub fn from_rotate(degrees: f32) -> Transform
Rotation around the origin by the given angle in degrees.
Sourcepub fn from_rotate_at(degrees: f32, cx: f32, cy: f32) -> Transform
pub fn from_rotate_at(degrees: f32, cx: f32, cy: f32) -> Transform
Rotation around the point (cx, cy).
pub fn is_identity(&self) -> bool
Sourcepub fn pre_concat(&self, other: Transform) -> Transform
pub fn pre_concat(&self, other: Transform) -> Transform
Composition: applies other first, then self.
Sourcepub fn post_concat(&self, other: Transform) -> Transform
pub fn post_concat(&self, other: Transform) -> Transform
Composition: applies self first, then other.
Sourcepub fn map_points(&self, points: &mut [Point])
pub fn map_points(&self, points: &mut [Point])
Maps a slice of points in place.
Trait Implementations§
impl Copy for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations§
impl Freeze for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnsafeUnpin for Transform
impl UnwindSafe for Transform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more