pub struct Transform(_);
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
sourceimpl 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
impl Copy for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnwindSafe for Transform
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more