[][src]Struct tiny_skia::Transform

pub struct Transform { /* fields omitted */ }

An affine transformation matrix.

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

Guarantees

  • All values are finite.

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
) -> Option<Self>
[src]

Creates a new Transform.

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

Checks

  • All values must be finite.
  • sx and sy must not be zero.

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

Creates a new Transform without checking values.

Safety

  • All values must be finite.
  • sx and sy must be non-zero.

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

Creates a new translating Transform.

Checks

  • All values must be finite.

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

Creates a new scaling Transform.

Checks

  • All values must be finite.
  • sx and sy must not be zero.

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

Creates a new skewing Transform.

Checks

  • All values must be finite.

pub fn get_scale(&self) -> (f32, f32)[src]

Returns scale pair.

pub fn get_skew(&self) -> (f32, f32)[src]

Returns skew pair.

pub fn get_translate(&self) -> (f32, f32)[src]

Returns translate pair.

pub fn get_row(&self) -> (f32, f32, f32, f32, f32, f32)[src]

Returns all values.

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) -> Option<Self>[src]

Pre-scales the current transform.

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

Post-scales the current transform.

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

Pre-translates the current transform.

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

Post-translates the current transform.

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

Pre-concats the current transform.

#[must_use]pub fn post_concat(&self, other: &Self) -> Option<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]

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.