Struct tiny_skia::Transform[][src]

pub struct Transform {
    pub sx: f32,
    pub kx: f32,
    pub ky: f32,
    pub sy: f32,
    pub tx: f32,
    pub ty: f32,
}

An affine transformation matrix.

Stores scale, skew and transform coordinates and a type of a transform.

Fields

sx: f32kx: f32ky: f32sy: f32tx: f32ty: f32

Implementations

impl Transform[src]

pub fn identity() -> Self[src]

Creates an identity transform.

pub fn from_row(sx: f32, ky: f32, kx: f32, sy: f32, tx: f32, ty: f32) -> Self[src]

Creates a new Transform.

We are using column-major-column-vector matrix notation, therefore it’s ky-kx, not kx-ky.

pub fn from_translate(tx: f32, ty: f32) -> Self[src]

Creates a new translating Transform.

pub fn from_scale(sx: f32, sy: f32) -> Self[src]

Creates a new scaling Transform.

pub fn from_skew(kx: f32, ky: f32) -> Self[src]

Creates a new skewing Transform.

pub fn from_rotate(angle: f32) -> Self[src]

Creates a new rotating Transform.

pub fn from_rotate_at(angle: f32, tx: f32, ty: f32) -> Self[src]

Creates a new rotating Transform at the specified position.

pub fn is_identity(&self) -> bool[src]

Checks that transform is identity.

The transform type is detected on creation, so this method is essentially free.

pub fn is_scale(&self) -> bool[src]

Checks that transform is scale-only.

The transform type is detected on creation, so this method is essentially free.

pub fn is_skew(&self) -> bool[src]

Checks that transform is skew-only.

The transform type is detected on creation, so this method is essentially free.

pub fn is_translate(&self) -> bool[src]

Checks that transform is translate-only.

The transform type is detected on creation, so this method is essentially free.

pub fn is_scale_translate(&self) -> bool[src]

Checks that transform contains only scale and translate.

The transform type is detected on creation, so this method is essentially free.

pub fn has_scale(&self) -> bool[src]

Checks that transform contains a scale part.

The transform type is detected on creation, so this method is essentially free.

pub fn has_skew(&self) -> bool[src]

Checks that transform contains a skew part.

The transform type is detected on creation, so this method is essentially free.

pub fn has_translate(&self) -> bool[src]

Checks that transform contains a translate part.

The transform type is detected on creation, so this method is essentially free.

#[must_use]pub fn pre_scale(&self, sx: f32, sy: f32) -> Self[src]

Pre-scales the current transform.

#[must_use]pub fn post_scale(&mut self, sx: f32, sy: f32) -> Self[src]

Post-scales the current transform.

#[must_use]pub fn pre_translate(&self, tx: f32, ty: f32) -> Self[src]

Pre-translates the current transform.

#[must_use]pub fn post_translate(&self, tx: f32, ty: f32) -> Self[src]

Post-translates the current transform.

#[must_use]pub fn pre_concat(&self, other: Self) -> Self[src]

Pre-concats the current transform.

#[must_use]pub fn post_concat(&self, other: Self) -> Self[src]

Post-concats the current transform.

Trait Implementations

impl Clone for Transform[src]

impl Copy for Transform[src]

impl Debug for Transform[src]

impl Default for Transform[src]

impl PartialEq<Transform> for Transform[src]

impl StructuralPartialEq for Transform[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.