Enum webrender::util::FastTransform
source · pub enum FastTransform<Src, Dst> {
Offset(Vector2D<f32, Src>),
Transform {
transform: Transform3D<f32, Src, Dst>,
inverse: Option<Transform3D<f32, Dst, Src>>,
is_2d: bool,
},
}
Expand description
An enum that tries to avoid expensive transformation matrix calculations when possible when dealing with non-perspective axis-aligned transformations.
Variants§
Offset(Vector2D<f32, Src>)
A simple offset, which can be used without doing any matrix math.
Transform
A 2D transformation with an inverse.
Implementations§
source§impl<Src, Dst> FastTransform<Src, Dst>
impl<Src, Dst> FastTransform<Src, Dst>
pub fn identity() -> Self
pub fn with_vector(offset: Vector2D<f32, Src>) -> Self
pub fn with_scale_offset(scale_offset: ScaleOffset) -> Self
pub fn with_transform(transform: Transform3D<f32, Src, Dst>) -> Self
pub fn to_transform(&self) -> Cow<'_, Transform3D<f32, Src, Dst>>
sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Return true if this is an identity transform
pub fn then<NewDst>( &self, other: &FastTransform<Dst, NewDst>, ) -> FastTransform<Src, NewDst>
pub fn pre_transform<NewSrc>( &self, other: &FastTransform<NewSrc, Src>, ) -> FastTransform<NewSrc, Dst>
pub fn pre_translate(&self, other_offset: Vector2D<f32, Src>) -> Self
pub fn then_translate(&self, other_offset: Vector2D<f32, Dst>) -> Self
pub fn is_backface_visible(&self) -> bool
pub fn transform_point2d( &self, point: Point2D<f32, Src>, ) -> Option<Point2D<f32, Dst>>
pub fn project_point2d( &self, point: Point2D<f32, Src>, ) -> Option<Point2D<f32, Dst>>
pub fn inverse(&self) -> Option<FastTransform<Dst, Src>>
Trait Implementations§
source§impl<Src, Dst> Clone for FastTransform<Src, Dst>
impl<Src, Dst> Clone for FastTransform<Src, Dst>
source§impl<Src, Dst> From<Transform3D<f32, Src, Dst>> for FastTransform<Src, Dst>
impl<Src, Dst> From<Transform3D<f32, Src, Dst>> for FastTransform<Src, Dst>
source§fn from(transform: Transform3D<f32, Src, Dst>) -> Self
fn from(transform: Transform3D<f32, Src, Dst>) -> Self
Converts to this type from the input type.
source§impl<Src, Dst> MallocSizeOf for FastTransform<Src, Dst>where
Src: MallocSizeOf,
Dst: MallocSizeOf,
impl<Src, Dst> MallocSizeOf for FastTransform<Src, Dst>where
Src: MallocSizeOf,
Dst: MallocSizeOf,
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl<Src, Dst> Serialize for FastTransform<Src, Dst>
impl<Src, Dst> Serialize for FastTransform<Src, Dst>
impl<Src, Dst> Copy for FastTransform<Src, Dst>
Auto Trait Implementations§
impl<Src, Dst> Freeze for FastTransform<Src, Dst>
impl<Src, Dst> RefUnwindSafe for FastTransform<Src, Dst>where
Src: RefUnwindSafe,
Dst: RefUnwindSafe,
impl<Src, Dst> Send for FastTransform<Src, Dst>
impl<Src, Dst> Sync for FastTransform<Src, Dst>
impl<Src, Dst> Unpin for FastTransform<Src, Dst>
impl<Src, Dst> UnwindSafe for FastTransform<Src, Dst>where
Src: UnwindSafe,
Dst: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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