Struct usvg_tree::Transform

source ·
pub struct Transform {
    pub a: f64,
    pub b: f64,
    pub c: f64,
    pub d: f64,
    pub e: f64,
    pub f: f64,
}
Expand description

Representation of the <transform> type.

Fields§

§a: f64§b: f64§c: f64§d: f64§e: f64§f: f64

Implementations§

source§

impl Transform

source

pub fn new(a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) -> Self

Constructs a new transform.

source

pub fn new_translate(x: f64, y: f64) -> Self

Constructs a new translate transform.

source

pub fn new_scale(sx: f64, sy: f64) -> Self

Constructs a new scale transform.

source

pub fn new_rotate(angle: f64) -> Self

Constructs a new rotate transform.

source

pub fn from_bbox(bbox: Rect) -> Self

Converts Rect into bbox Transform.

source

pub fn translate(&mut self, x: f64, y: f64)

Translates the current transform.

source

pub fn scale(&mut self, sx: f64, sy: f64)

Scales the current transform.

source

pub fn rotate(&mut self, angle: f64)

Rotates the current transform.

source

pub fn rotate_at(&mut self, angle: f64, x: f64, y: f64)

Rotates the current transform at the specified position.

source

pub fn append(&mut self, other: &Transform)

Appends transform to the current transform.

source

pub fn prepend(&mut self, other: &Transform)

Prepends transform to the current transform.

source

pub fn is_default(&self) -> bool

Returns true if the transform is default, aka (1 0 0 1 0 0).

source

pub fn get_translate(&self) -> (f64, f64)

Returns transform’s translate part.

source

pub fn get_scale(&self) -> (f64, f64)

Returns transform’s scale part.

source

pub fn apply(&self, x: f64, y: f64) -> (f64, f64)

Applies transform to selected coordinates.

source

pub fn apply_to(&self, x: &mut f64, y: &mut f64)

Applies transform to selected coordinates.

Trait Implementations§

source§

impl Clone for Transform

source§

fn clone(&self) -> Transform

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Transform

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Transform

source§

fn default() -> Transform

Returns the “default value” for a type. Read more
source§

impl From<Transform> for Transform

source§

fn from(ts: Transform) -> Self

Converts to this type from the input type.
source§

impl FuzzyEq<Transform> for Transform

source§

fn fuzzy_eq(&self, other: &Self) -> bool

Returns true if values are approximately equal.
source§

fn fuzzy_ne(&self, other: &Rhs) -> bool

Returns true if values are not approximately equal.
source§

impl PartialEq<Transform> for Transform

source§

fn eq(&self, other: &Transform) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Transform

source§

impl StructuralPartialEq for Transform

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.