pub struct Transform(/* private fields */);
Expand description
2D affine transformation
Stored as an array [m00, m01, m02, m10, m11, m12], semantically corresponds to a matrix: ┌ ┐ │ m00 m01 m02 │ │ m11 m11 m12 │ │ 0 0 1 │ └ ┘
Implementations§
source§impl Transform
impl Transform
pub fn new( m00: Scalar, m01: Scalar, m02: Scalar, m10: Scalar, m11: Scalar, m12: Scalar ) -> Self
pub fn identity() -> Self
sourcepub fn pre_translate(&self, tx: Scalar, ty: Scalar) -> Self
pub fn pre_translate(&self, tx: Scalar, ty: Scalar) -> Self
Apply translation by [tx, ty]
before self
pub fn new_translate(tx: Scalar, ty: Scalar) -> Self
sourcepub fn pre_scale(&self, sx: Scalar, sy: Scalar) -> Self
pub fn pre_scale(&self, sx: Scalar, sy: Scalar) -> Self
Apply scale transformation by [sx, sy]
before self
pub fn new_scale(sx: Scalar, sy: Scalar) -> Self
sourcepub fn pre_rotate(&self, a: Scalar) -> Self
pub fn pre_rotate(&self, a: Scalar) -> Self
Apply rotation by a
angle around the origin before self
pub fn new_rotate(a: Scalar) -> Self
sourcepub fn pre_rotate_around(&self, a: Scalar, p: impl Into<Point>) -> Self
pub fn pre_rotate_around(&self, a: Scalar, p: impl Into<Point>) -> Self
Apply rotation around point p
by angle a
before self
sourcepub fn pre_skew(&self, ax: Scalar, ay: Scalar) -> Self
pub fn pre_skew(&self, ax: Scalar, ay: Scalar) -> Self
Apply skew transformation by [ax, ay]
before self
pub fn new_skew(ax: Scalar, ay: Scalar) -> Self
sourcepub fn pre_concat(&self, other: Self) -> Self
pub fn pre_concat(&self, other: Self) -> Self
Apply other transformation before the current one
sourcepub fn post_concat(&self, other: Self) -> Self
pub fn post_concat(&self, other: Self) -> Self
Apply other transformation after the current one
sourcepub fn line_to_line(src: Line, dst: Line) -> Option<Self>
pub fn line_to_line(src: Line, dst: Line) -> Option<Self>
Create transformation which converts src
line segment to dst
line segment
sourcepub fn make_horizontal(line: Line) -> Transform
pub fn make_horizontal(line: Line) -> Transform
Create transformation which makes line horizontal with origin at (0, 0).
Trait Implementations§
source§impl PartialEq for Transform
impl PartialEq for Transform
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 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