pub struct DrawTransform {
pub matrix: [f32; 6],
}Expand description
2D transformation matrix.
Fields§
§matrix: [f32; 6]Matrix elements [a, b, c, d, e, f] | a c e | | b d f | | 0 0 1 |
Implementations§
Source§impl Transform2D
impl Transform2D
Sourcepub const fn identity() -> Transform2D
pub const fn identity() -> Transform2D
Identity transformation.
Sourcepub const fn translate(x: f32, y: f32) -> Transform2D
pub const fn translate(x: f32, y: f32) -> Transform2D
Create a translation transform.
Sourcepub const fn scale(sx: f32, sy: f32) -> Transform2D
pub const fn scale(sx: f32, sy: f32) -> Transform2D
Create a scale transform.
Sourcepub fn rotate(angle: f32) -> Transform2D
pub fn rotate(angle: f32) -> Transform2D
Create a rotation transform (radians).
Sourcepub fn then(&self, other: &Transform2D) -> Transform2D
pub fn then(&self, other: &Transform2D) -> Transform2D
Chain transforms: first apply self, then apply other.
For point p: a.then(b).apply(p) == b.apply(a.apply(p))
Trait Implementations§
Source§impl Clone for Transform2D
impl Clone for Transform2D
Source§fn clone(&self) -> Transform2D
fn clone(&self) -> Transform2D
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for Transform2D
Source§impl Debug for Transform2D
impl Debug for Transform2D
Source§impl Default for Transform2D
impl Default for Transform2D
Source§fn default() -> Transform2D
fn default() -> Transform2D
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Transform2D
impl<'de> Deserialize<'de> for Transform2D
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Transform2D, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Transform2D, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Transform2D
impl PartialEq for Transform2D
Source§fn eq(&self, other: &Transform2D) -> bool
fn eq(&self, other: &Transform2D) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Transform2D
impl Serialize for Transform2D
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Transform2D
Auto Trait Implementations§
impl Freeze for Transform2D
impl RefUnwindSafe for Transform2D
impl Send for Transform2D
impl Sync for Transform2D
impl Unpin for Transform2D
impl UnsafeUnpin for Transform2D
impl UnwindSafe for Transform2D
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