Struct nanovg::Transform
[−]
[src]
pub struct Transform { pub matrix: [f32; 6], // some fields omitted }
Represents a transformation in 2D space. A transformation is a column-major matrix in the following form: [a c e] - indices [0 2 4] [b d f] - indices [1 3 5] [0 0 1] - not passed. The last row however is not specified; it is always [0 0 1] behind the scenes.
Fields
matrix: [f32; 6]
Methods
impl Transform
[src]
pub fn new() -> Self
[src]
Construct a new transform with an identity matrix.
pub fn absolute(self) -> Self
[src]
Set flag on this transform to use it in absolute coordinate space.
pub fn relative(self) -> Self
[src]
Set flag on this transform to use it in local (relative) coordinate space.
pub fn with_translation(self, x: f32, y: f32) -> Self
[src]
Set the translation of the transform.
pub fn with_scale(self, x: f32, y: f32) -> Self
[src]
Set the scale of the transform.
pub fn with_skew(self, x: f32, y: f32) -> Self
[src]
Set the skew of the transform.
pub fn with_rotation(self, theta: f32) -> Self
[src]
Set the rotation of the transform.
pub fn translate(self, x: f32, y: f32) -> Self
[src]
Translate transform by x and y.
pub fn rotate(self, angle: f32) -> Self
[src]
Rotate transform with spcified angle.
pub fn skew_x(self, angle: f32) -> Self
[src]
Skew transform along x axis with specified angle.
pub fn skew_y(self, angle: f32) -> Self
[src]
Skew transform along y axis with specified angle.
pub fn scale(self, x: f32, y: f32) -> Self
[src]
Scale transform along x and y.
pub fn transform_point(&self, (x, y): (f32, f32)) -> (f32, f32)
[src]
Transforms a point with this transform. Returns transformed point (x, y).
pub fn try_inverse(&self) -> Option<Transform>
[src]
Inverses this transform. Returns inversed copy or None if inversion fails.
Trait Implementations
impl Clone for Transform
[src]
fn clone(&self) -> Transform
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Transform
[src]
impl Debug for Transform
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Mul for Transform
[src]
Implementation of multiplication Trait for Transform. The order in which you multiplicate matters (you are multiplicating matrices)