Struct nanovg::Transform[][src]

pub struct Transform {
    pub matrix: [f32; 6],
    // some fields omitted
}

Represents a transformation in 2D space.

A transformation is a combination of translation (aka. position), skew and scale or translation and rotation; implemented as 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] - only theoretical / does not really exist. Logically it is always [0 0 1].

Fields

Methods

impl Transform
[src]

Construct a new transform with an identity matrix.

Set flag on this transform to use it in absolute coordinate space. Only applies to text.

Set flag on this transform to use it in local (relative) coordinate space. Only applies to text.

Set the translation of the transform.

Set the scale of the transform.

Set the skew of the transform.

Set the rotation of the transform.

Translate transform by x and y.

Rotate transform with spcified angle.

Skew transform along x axis with specified angle.

Skew transform along y axis with specified angle.

Scale transform along x and y.

Transforms a point with this transform. Returns transformed point (x, y).

Inverses this transform. Returns inversed copy or None if inversion fails.

Trait Implementations

impl Clone for Transform
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Transform
[src]

impl Debug for Transform
[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)

The resulting type after applying the * operator.

Multiplies transform with other transform (the order matters).

Auto Trait Implementations

impl Send for Transform

impl Sync for Transform