pub struct Transform<T>where
T: Float,{
pub matrix: Transform3D<T>,
pub relative_translation: (T, T),
}Expand description
Decomposition of a CSS transform into a constant 3D transform and a relative 2D translation (i.e. CSS percentage).
Fields§
§matrix: Transform3D<T>This is the underlying, layout-independent 3D affine transformation matrix.
relative_translation: (T, T)This is the underlying, layout-dependent relative translation (measured in percentage points). This translation should be applied after the layout-independent 3D affine transformation matrix.
Implementations§
Source§impl<T> Transform<T>where
T: Float,
impl<T> Transform<T>where
T: Float,
Sourcepub fn with_transform(matrix: Transform3D<T>) -> Transform<T>
pub fn with_transform(matrix: Transform3D<T>) -> Transform<T>
This function creates a new transform with the given coefficients.
Sourcepub fn with_matrix(matrix: [T; 6]) -> Transform<T>
pub fn with_matrix(matrix: [T; 6]) -> Transform<T>
This function creates a new homogeneous transform from the given coefficients.
Sourcepub fn with_matrix3d(matrix: [T; 16]) -> Transform<T>
pub fn with_matrix3d(matrix: [T; 16]) -> Transform<T>
This function creates a new homogeneous transform from the given coefficients.
Sourcepub fn with_perspective(d: T) -> Transform<T>
pub fn with_perspective(d: T) -> Transform<T>
This function creates a new perspective transform with the given parameters.
Sourcepub fn with_rotation(rx: T, ry: T, rz: T, angle: Angle<T>) -> Transform<T>where
T: FloatConst,
pub fn with_rotation(rx: T, ry: T, rz: T, angle: Angle<T>) -> Transform<T>where
T: FloatConst,
This function creates a new rotation transform with the given parameters.
Sourcepub fn with_scale(sx: T, sy: T, sz: T) -> Transform<T>
pub fn with_scale(sx: T, sy: T, sz: T) -> Transform<T>
This function creates a new scale transform with the given parameters.
Sourcepub fn with_skew_x(sx: Angle<T>) -> Transform<T>
pub fn with_skew_x(sx: Angle<T>) -> Transform<T>
This function creates a new horizontal skew transform with the given angle.
Sourcepub fn with_skew_y(sy: Angle<T>) -> Transform<T>
pub fn with_skew_y(sy: Angle<T>) -> Transform<T>
This function creates a new vertical skew transform with the given angle.
Sourcepub fn with_translation(
tx: Dimension<T>,
ty: Dimension<T>,
tz: T,
) -> Transform<T>
pub fn with_translation( tx: Dimension<T>, ty: Dimension<T>, tz: T, ) -> Transform<T>
This function creates a new translation transform with the given parameters. If one of the horizontal or vertical dimensions is relative (i.e. a percentage), this transform will need to be resolved before it can be applied.
Sourcepub fn is_resolved(&self) -> bool
pub fn is_resolved(&self) -> bool
This function returns a boolean that indicates if this transform is resolved, i.e. its relative translation is zero in both dimensions.
Sourcepub fn resolve(&self, size: Size<T>) -> Transform3D<T>
pub fn resolve(&self, size: Size<T>) -> Transform3D<T>
This function resolves a transform using the given size.
Trait Implementations§
impl<T> Copy for Transform<T>
impl<T> StructuralPartialEq for Transform<T>where
T: Float,
Auto Trait Implementations§
impl<T> Freeze for Transform<T>where
T: Freeze,
impl<T> RefUnwindSafe for Transform<T>where
T: RefUnwindSafe,
impl<T> Send for Transform<T>where
T: Send,
impl<T> Sync for Transform<T>where
T: Sync,
impl<T> Unpin for Transform<T>where
T: Unpin,
impl<T> UnwindSafe for Transform<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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,
Source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
Source§fn convert_into(self) -> U
fn convert_into(self) -> U
Source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
Source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains the unclamped color. Read more