Struct ScaleOffset2D
pub struct ScaleOffset2D<T, Src, Dst> {
pub sx: T,
pub sy: T,
pub tx: T,
pub ty: T,
/* private fields */
}canvas only.Fields§
§sx: T§sy: T§tx: T§ty: TImplementations§
§impl<T, Src, Dst> ScaleOffset2D<T, Src, Dst>
impl<T, Src, Dst> ScaleOffset2D<T, Src, Dst>
pub fn identity() -> ScaleOffset2D<T, Src, Dst>
pub fn identity() -> ScaleOffset2D<T, Src, Dst>
Create an identity transform.
pub fn new(sx: T, sy: T, tx: T, ty: T) -> ScaleOffset2D<T, Src, Dst>
pub fn new(sx: T, sy: T, tx: T, ty: T) -> ScaleOffset2D<T, Src, Dst>
Create a transform with provided scale and offset terms.
pub fn scale(sx: T, sy: T) -> ScaleOffset2D<T, Src, Dst>where
T: Zero,
pub fn scale(sx: T, sy: T) -> ScaleOffset2D<T, Src, Dst>where
T: Zero,
Create a transform from a scale.
pub fn offset(tx: T, ty: T) -> ScaleOffset2D<T, Src, Dst>where
T: One,
pub fn offset(tx: T, ty: T) -> ScaleOffset2D<T, Src, Dst>where
T: One,
Create a transform from an offset.
pub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Returns true if self is an identity transform, using T’s
default epsilon value.
pub fn is_identity_eps(&self, epsilon: T) -> bool
pub fn is_identity_eps(&self, epsilon: T) -> bool
Returns true if self is an identity transform.
§impl<T, Src, Dst> ScaleOffset2D<T, Src, Dst>where
T: Copy,
impl<T, Src, Dst> ScaleOffset2D<T, Src, Dst>where
T: Copy,
pub fn transform_point(&self, p: Point2D<T, Src>) -> Point2D<T, Dst>
pub fn transform_point(&self, p: Point2D<T, Src>) -> Point2D<T, Dst>
Returns the given point transformed by this transform.
pub fn transform_vector(&self, v: Vector2D<T, Src>) -> Vector2D<T, Dst>where
T: Mul<Output = T>,
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.
pub fn transform_box(&self, b: &Box2D<T, Src>) -> Box2D<T, Dst>
pub fn transform_box(&self, b: &Box2D<T, Src>) -> Box2D<T, Dst>
Returns the given box transformed by this transform.
pub fn transform_rect(&self, r: &Rect<T, Src>) -> Rect<T, Dst>
pub fn transform_rect(&self, r: &Rect<T, Src>) -> Rect<T, Dst>
Returns the given rectangle transformed by this transform.
pub fn then<NewDst>(
&self,
other: &ScaleOffset2D<T, Dst, NewDst>,
) -> ScaleOffset2D<T, Src, NewDst>
pub fn then<NewDst>( &self, other: &ScaleOffset2D<T, Dst, NewDst>, ) -> ScaleOffset2D<T, Src, NewDst>
Produce a ScaleOffset2D that includes both self and other.
The ‘other’ ScaleOffset2D is applied after self.
This is equivalent to Transform2D::then.
pub fn pre_translate(&self, v: Vector2D<T, Src>) -> ScaleOffset2D<T, Src, Dst>
pub fn pre_translate(&self, v: Vector2D<T, Src>) -> ScaleOffset2D<T, Src, Dst>
Applies a translation before self’s transformation and returns the resulting transform.
pub fn then_translate(&self, v: Vector2D<T, Dst>) -> ScaleOffset2D<T, Src, Dst>
pub fn then_translate(&self, v: Vector2D<T, Dst>) -> ScaleOffset2D<T, Src, Dst>
Applies a translation after self’s transformation and returns the resulting transform.
pub fn pre_scale(&self, sx: T, sy: T) -> ScaleOffset2D<T, Src, Dst>
pub fn pre_scale(&self, sx: T, sy: T) -> ScaleOffset2D<T, Src, Dst>
Applies a scale before self’s transformation and returns the resulting transform.
pub fn then_scale(&self, sx: T, sy: T) -> ScaleOffset2D<T, Src, Dst>
pub fn then_scale(&self, sx: T, sy: T) -> ScaleOffset2D<T, Src, Dst>
Applies a scale after self’s transformation and returns the resulting transform.
pub fn is_invertible(&self) -> bool
pub fn is_invertible(&self) -> bool
Returns whether it is possible to compute the inverse transform.
pub fn inverse(&self) -> Option<ScaleOffset2D<T, Dst, Src>>
pub fn inverse(&self) -> Option<ScaleOffset2D<T, Dst, Src>>
Returns the inverse transform if possible.
pub fn to_transform2d(&self) -> Transform2D<T, Src, Dst>where
T: Zero,
pub fn to_transform2d(&self) -> Transform2D<T, Src, Dst>where
T: Zero,
Returns the same transform using Transform2D’s matrix representation.
pub fn to_transform3d(&self) -> Transform3D<T, Src, Dst>
pub fn to_transform3d(&self) -> Transform3D<T, Src, Dst>
Returns the same transform using Transform3D’s matrix representation.
pub fn to_array(&self) -> [T; 4]
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.
pub fn with_source<NewSrc>(&self) -> ScaleOffset2D<T, NewSrc, Dst>
pub fn with_source<NewSrc>(&self) -> ScaleOffset2D<T, NewSrc, Dst>
Returns the same transform with a different source unit.
pub fn with_destination<NewDst>(&self) -> ScaleOffset2D<T, Src, NewDst>
pub fn with_destination<NewDst>(&self) -> ScaleOffset2D<T, Src, NewDst>
Returns the same transform with a different destination unit.
pub fn to_untyped(&self) -> ScaleOffset2D<T, UnknownUnit, UnknownUnit>
pub fn to_untyped(&self) -> ScaleOffset2D<T, UnknownUnit, UnknownUnit>
Drop the units, preserving only the numeric value.
pub fn from_untyped(
val: ScaleOffset2D<T, UnknownUnit, UnknownUnit>,
) -> ScaleOffset2D<T, Src, Dst>
pub fn from_untyped( val: ScaleOffset2D<T, UnknownUnit, UnknownUnit>, ) -> ScaleOffset2D<T, Src, Dst>
Tag a unitless value with units.
Trait Implementations§
§impl<T, Src, Dst> ApproxEq<T> for ScaleOffset2D<T, Src, Dst>where
T: ApproxEq<T>,
impl<T, Src, Dst> ApproxEq<T> for ScaleOffset2D<T, Src, Dst>where
T: ApproxEq<T>,
§fn approx_eq_eps(&self, other: &ScaleOffset2D<T, Src, Dst>, eps: &T) -> bool
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.
§fn approx_epsilon() -> T
fn approx_epsilon() -> T
§fn approx_eq(&self, other: &Self) -> bool
fn approx_eq(&self, other: &Self) -> bool
true if this object is approximately equal to the other one, using
the approx_epsilon epsilon value.§impl<T, Src, Dst> Clone for ScaleOffset2D<T, Src, Dst>where
T: Clone,
impl<T, Src, Dst> Clone for ScaleOffset2D<T, Src, Dst>where
T: Clone,
§fn clone(&self) -> ScaleOffset2D<T, Src, Dst>
fn clone(&self) -> ScaleOffset2D<T, Src, Dst>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<T, Src, Dst> Debug for ScaleOffset2D<T, Src, Dst>
impl<T, Src, Dst> Debug for ScaleOffset2D<T, Src, Dst>
§impl<T, Src, Dst> Default for ScaleOffset2D<T, Src, Dst>
impl<T, Src, Dst> Default for ScaleOffset2D<T, Src, Dst>
§fn default() -> ScaleOffset2D<T, Src, Dst>
fn default() -> ScaleOffset2D<T, Src, Dst>
Returns the identity transform.
§impl<T, Src, Dst> From<Scale<T, Src, Dst>> for ScaleOffset2D<T, Src, Dst>
impl<T, Src, Dst> From<Scale<T, Src, Dst>> for ScaleOffset2D<T, Src, Dst>
§fn from(s: Scale<T, Src, Dst>) -> ScaleOffset2D<T, Src, Dst>
fn from(s: Scale<T, Src, Dst>) -> ScaleOffset2D<T, Src, Dst>
§impl<T, Src, Dst> From<ScaleOffset2D<T, Src, Dst>> for Transform2D<T, Src, Dst>
impl<T, Src, Dst> From<ScaleOffset2D<T, Src, Dst>> for Transform2D<T, Src, Dst>
§fn from(t: ScaleOffset2D<T, Src, Dst>) -> Transform2D<T, Src, Dst>
fn from(t: ScaleOffset2D<T, Src, Dst>) -> Transform2D<T, Src, Dst>
§impl<T, Src, Dst> From<Translation2D<T, Src, Dst>> for ScaleOffset2D<T, Src, Dst>
impl<T, Src, Dst> From<Translation2D<T, Src, Dst>> for ScaleOffset2D<T, Src, Dst>
§fn from(t: Translation2D<T, Src, Dst>) -> ScaleOffset2D<T, Src, Dst>
fn from(t: Translation2D<T, Src, Dst>) -> ScaleOffset2D<T, Src, Dst>
§impl<T, Src, Dst> Hash for ScaleOffset2D<T, Src, Dst>where
T: Hash,
impl<T, Src, Dst> Hash for ScaleOffset2D<T, Src, Dst>where
T: Hash,
§impl<T, Src, Dst> PartialEq for ScaleOffset2D<T, Src, Dst>where
T: PartialEq,
impl<T, Src, Dst> PartialEq for ScaleOffset2D<T, Src, Dst>where
T: PartialEq,
impl<T, Src, Dst> Copy for ScaleOffset2D<T, Src, Dst>where
T: Copy,
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>
impl<T, Src, Dst> Sync for ScaleOffset2D<T, Src, Dst>
impl<T, Src, Dst> Unpin for ScaleOffset2D<T, Src, Dst>
impl<T, Src, Dst> UnwindSafe for ScaleOffset2D<T, Src, Dst>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().