pub struct Transform {
pub xx: f64,
pub yx: f64,
pub xy: f64,
pub yy: f64,
pub x0: f64,
pub y0: f64,
}
Expand description
A 2D transformation matrix.
Fields§
§xx: f64
§yx: f64
§xy: f64
§yy: f64
§x0: f64
§y0: f64
Implementations§
source§impl Transform
impl Transform
pub fn new_unchecked( xx: f64, yx: f64, xy: f64, yy: f64, x0: f64, y0: f64, ) -> Self
pub fn identity() -> Self
pub fn new_translate(tx: f64, ty: f64) -> Self
pub fn new_scale(sx: f64, sy: f64) -> Self
pub fn new_rotate(a: Angle) -> Self
pub fn new_skew(ax: Angle, ay: Angle) -> Self
pub fn multiply(t1: &Transform, t2: &Transform) -> Self
pub fn pre_transform(&self, t: &Transform) -> Self
pub fn post_transform(&self, t: &Transform) -> Self
pub fn pre_translate(&self, x: f64, y: f64) -> Self
pub fn pre_scale(&self, sx: f64, sy: f64) -> Self
pub fn pre_rotate(&self, angle: Angle) -> Self
pub fn post_translate(&self, x: f64, y: f64) -> Self
pub fn post_scale(&self, sx: f64, sy: f64) -> Self
pub fn post_rotate(&self, angle: Angle) -> Self
fn determinant(&self) -> f64
pub fn is_invertible(&self) -> bool
pub fn invert(&self) -> Option<Self>
pub fn transform_distance(&self, dx: f64, dy: f64) -> (f64, f64)
pub fn transform_point(&self, px: f64, py: f64) -> (f64, f64)
pub fn transform_rect(&self, rect: &Rect) -> Rect
Trait Implementations§
source§impl PartialEq for Transform
impl PartialEq for Transform
source§impl TryFrom<Transform> for ValidTransform
impl TryFrom<Transform> for ValidTransform
source§fn try_from(t: Transform) -> Result<ValidTransform, InvalidTransform>
fn try_from(t: Transform) -> Result<ValidTransform, InvalidTransform>
Validates a Transform
before converting it to a ValidTransform
.
A transform is valid if it is invertible. For example, a matrix with all-zeros is not invertible, and it is invalid.
§type Error = InvalidTransform
type Error = InvalidTransform
The type returned in the event of a conversion error.
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.