Skip to main content

ScaleOffset2D

Struct ScaleOffset2D 

Source
pub struct ScaleOffset2D<T, Src, Dst> {
    pub sx: T,
    pub sy: T,
    pub tx: T,
    pub ty: T,
    /* private fields */
}

Fields§

§sx: T§sy: T§tx: T§ty: T

Implementations§

Source§

impl<T, Src, Dst> ScaleOffset2D<T, Src, Dst>

Source

pub fn identity() -> ScaleOffset2D<T, Src, Dst>
where T: Zero + One,

Create an identity transform.

Source

pub fn new(sx: T, sy: T, tx: T, ty: T) -> ScaleOffset2D<T, Src, Dst>

Create a transform with provided scale and offset terms.

Source

pub fn scale(sx: T, sy: T) -> ScaleOffset2D<T, Src, Dst>
where T: Zero,

Create a transform from a scale.

Source

pub fn offset(tx: T, ty: T) -> ScaleOffset2D<T, Src, Dst>
where T: One,

Create a transform from an offset.

Source§

impl<T, Src, Dst> ScaleOffset2D<T, Src, Dst>
where T: Copy,

Source

pub fn transform_point(&self, p: Point2D<T, Src>) -> Point2D<T, Dst>
where T: Add<Output = T> + Mul<Output = T>,

Returns the given point transformed by this transform.

Source

pub fn transform_vector(&self, v: Vector2D<T, Src>) -> Vector2D<T, Dst>
where T: Mul<Output = T>,

Returns the given vector transformed by this transform.

Source

pub fn transform_box(&self, b: &Box2D<T, Src>) -> Box2D<T, Dst>
where T: Zero + Add<Output = T> + Mul<Output = T> + PartialOrd,

Returns the given box transformed by this transform.

Source

pub fn transform_rect(&self, r: &Rect<T, Src>) -> Rect<T, Dst>
where T: Zero + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + PartialOrd,

Returns the given rectangle transformed by this transform.

Source

pub fn then<NewDst>( &self, other: &ScaleOffset2D<T, Dst, NewDst>, ) -> ScaleOffset2D<T, Src, NewDst>
where T: Add<Output = T> + Mul<Output = T>,

Produce a ScaleOffset2D that includes both self and other. The ‘other’ ScaleOffset2D is applied after self.

This is equivalent to Transform2D::then.

Source

pub fn pre_translate(&self, v: Vector2D<T, Src>) -> ScaleOffset2D<T, Src, Dst>
where T: Add<Output = T> + Mul<Output = T>,

Applies a translation before self’s transformation and returns the resulting transform.

Source

pub fn then_translate(&self, v: Vector2D<T, Dst>) -> ScaleOffset2D<T, Src, Dst>
where T: Add<Output = T> + Mul<Output = T>,

Applies a translation after self’s transformation and returns the resulting transform.

Source

pub fn pre_scale(&self, sx: T, sy: T) -> ScaleOffset2D<T, Src, Dst>
where T: Add<Output = T> + Mul<Output = T>,

Applies a scale before self’s transformation and returns the resulting transform.

Source

pub fn then_scale(&self, sx: T, sy: T) -> ScaleOffset2D<T, Src, Dst>
where T: Add<Output = T> + Mul<Output = T>,

Applies a scale after self’s transformation and returns the resulting transform.

Source

pub fn is_invertible(&self) -> bool
where T: Zero + PartialEq,

Returns whether it is possible to compute the inverse transform.

Source

pub fn inverse(&self) -> Option<ScaleOffset2D<T, Dst, Src>>
where T: Zero + One + PartialEq + Div<Output = T> + Mul<Output = T> + Neg<Output = T>,

Returns the inverse transform if possible.

Source

pub fn to_transform2d(&self) -> Transform2D<T, Src, Dst>
where T: Zero,

Returns the same transform using Transform2D’s matrix representation.

Source

pub fn to_transform3d(&self) -> Transform3D<T, Src, Dst>
where T: Zero + One,

Returns the same transform using Transform3D’s matrix representation.

Source

pub fn to_array(&self) -> [T; 4]

Returns an array containing this transform’s terms.

The terms are laid out in the same order as they are specified in ScaleOffset2D::new.

Source

pub fn with_source<NewSrc>(&self) -> ScaleOffset2D<T, NewSrc, Dst>

Returns the same transform with a different source unit.

Source

pub fn with_destination<NewDst>(&self) -> ScaleOffset2D<T, Src, NewDst>

Returns the same transform with a different destination unit.

Source

pub fn to_untyped(&self) -> ScaleOffset2D<T, UnknownUnit, UnknownUnit>

Drop the units, preserving only the numeric value.

Source

pub fn from_untyped( val: ScaleOffset2D<T, UnknownUnit, UnknownUnit>, ) -> ScaleOffset2D<T, Src, Dst>

Tag a unitless value with units.

Source§

impl<T, Src, Dst> ScaleOffset2D<T, Src, Dst>
where T: Copy,

Source

pub fn is_identity(&self) -> bool
where T: One + Zero + ApproxEq<T>,

Returns true if self is an identity transform, using T’s default epsilon value.

Source

pub fn is_identity_eps(&self, epsilon: T) -> bool
where T: One + Zero + ApproxEq<T>,

Returns true if self is an identity transform.

Trait Implementations§

Source§

impl<T, Src, Dst> ApproxEq<T> for ScaleOffset2D<T, Src, Dst>
where T: ApproxEq<T>,

Source§

fn approx_eq_eps(&self, other: &ScaleOffset2D<T, Src, Dst>, eps: &T) -> bool

Returns true if this transform is approximately equal to the other one, using a provided epsilon value.

Source§

fn approx_epsilon() -> T

Default epsilon value
Source§

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

Returns true if this object is approximately equal to the other one, using the approx_epsilon epsilon value.
Source§

impl<T, Src, Dst> Clone for ScaleOffset2D<T, Src, Dst>
where T: Clone,

Source§

fn clone(&self) -> ScaleOffset2D<T, Src, Dst>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T, Src, Dst> Debug for ScaleOffset2D<T, Src, Dst>
where T: Copy + Debug + PartialEq + One + Zero + ApproxEq<T>,

Source§

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

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

impl<T, Src, Dst> Default for ScaleOffset2D<T, Src, Dst>
where T: Copy + Zero + One,

Source§

fn default() -> ScaleOffset2D<T, Src, Dst>

Returns the identity transform.

Source§

impl<T, Src, Dst> From<Scale<T, Src, Dst>> for ScaleOffset2D<T, Src, Dst>
where T: Copy + Zero,

Source§

fn from(s: Scale<T, Src, Dst>) -> ScaleOffset2D<T, Src, Dst>

Converts to this type from the input type.
Source§

impl<T, Src, Dst> From<ScaleOffset2D<T, Src, Dst>> for Transform2D<T, Src, Dst>
where T: Copy + Zero,

Source§

fn from(t: ScaleOffset2D<T, Src, Dst>) -> Transform2D<T, Src, Dst>

Converts to this type from the input type.
Source§

impl<T, Src, Dst> From<Translation2D<T, Src, Dst>> for ScaleOffset2D<T, Src, Dst>
where T: Copy + One,

Source§

fn from(t: Translation2D<T, Src, Dst>) -> ScaleOffset2D<T, Src, Dst>

Converts to this type from the input type.
Source§

impl<T, Src, Dst> Hash for ScaleOffset2D<T, Src, Dst>
where T: Hash,

Source§

fn hash<H>(&self, h: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T, Src, Dst> PartialEq for ScaleOffset2D<T, Src, Dst>
where T: PartialEq,

Source§

fn eq(&self, other: &ScaleOffset2D<T, Src, Dst>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, Src, Dst> Copy for ScaleOffset2D<T, Src, Dst>
where T: Copy,

Source§

impl<T, Src, Dst> Eq for ScaleOffset2D<T, Src, Dst>
where T: Eq,

Auto Trait Implementations§

§

impl<T, Src, Dst> Freeze for ScaleOffset2D<T, Src, Dst>
where T: Freeze,

§

impl<T, Src, Dst> RefUnwindSafe for ScaleOffset2D<T, Src, Dst>

§

impl<T, Src, Dst> Send for ScaleOffset2D<T, Src, Dst>
where T: Send, Src: Send, Dst: Send,

§

impl<T, Src, Dst> Sync for ScaleOffset2D<T, Src, Dst>
where T: Sync, Src: Sync, Dst: Sync,

§

impl<T, Src, Dst> Unpin for ScaleOffset2D<T, Src, Dst>
where T: Unpin, Src: Unpin, Dst: Unpin,

§

impl<T, Src, Dst> UnsafeUnpin for ScaleOffset2D<T, Src, Dst>
where T: UnsafeUnpin,

§

impl<T, Src, Dst> UnwindSafe for ScaleOffset2D<T, Src, Dst>
where T: UnwindSafe, Src: UnwindSafe, Dst: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DependencyElement for T
where T: 'static + PartialEq + Clone,