Struct femtovg::Transform2D
source · [−]Expand description
2×3 matrix (2 rows, 3 columns) used for 2D linear transformations. It can represent transformations such as translation, rotation, or scaling.
Tuple Fields
0: [f32; 6]
Implementations
sourceimpl Transform2D
impl Transform2D
sourcepub fn identity() -> Self
pub fn identity() -> Self
Creates an identity transformation with no translation, rotation or scaling applied.
pub fn new_translation(x: f32, y: f32) -> Self
pub fn translate(&mut self, tx: f32, ty: f32)
pub fn scale(&mut self, sx: f32, sy: f32)
pub fn rotate(&mut self, a: f32)
pub fn skew_x(&mut self, a: f32)
pub fn skew_y(&mut self, a: f32)
pub fn multiply(&mut self, other: &Self)
pub fn premultiply(&mut self, other: &Self)
pub fn inverse(&mut self)
pub fn inversed(&self) -> Self
pub fn transform_point(&self, sx: f32, sy: f32) -> (f32, f32)
pub fn average_scale(&self) -> f32
pub fn to_mat3x4(self) -> [f32; 12]
pub fn cache_key(&self) -> u64
Trait Implementations
sourceimpl Clone for Transform2D
impl Clone for Transform2D
sourcefn clone(&self) -> Transform2D
fn clone(&self) -> Transform2D
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Transform2D
impl Debug for Transform2D
sourceimpl Default for Transform2D
impl Default for Transform2D
sourceimpl Index<usize> for Transform2D
impl Index<usize> for Transform2D
sourceimpl IndexMut<usize> for Transform2D
impl IndexMut<usize> for Transform2D
sourceimpl PartialEq<Transform2D> for Transform2D
impl PartialEq<Transform2D> for Transform2D
sourcefn eq(&self, other: &Transform2D) -> bool
fn eq(&self, other: &Transform2D) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Transform2D) -> bool
fn ne(&self, other: &Transform2D) -> bool
This method tests for !=
.
sourceimpl PartialOrd<Transform2D> for Transform2D
impl PartialOrd<Transform2D> for Transform2D
sourcefn partial_cmp(&self, other: &Transform2D) -> Option<Ordering>
fn partial_cmp(&self, other: &Transform2D) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Transform2D
impl StructuralPartialEq for Transform2D
Auto Trait Implementations
impl RefUnwindSafe for Transform2D
impl Send for Transform2D
impl Sync for Transform2D
impl Unpin for Transform2D
impl UnwindSafe for Transform2D
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