Struct pax_runtime::api::Transform2D
source · pub struct Transform2D {
pub previous: Option<Box<Transform2D>>,
pub rotate: Option<Rotation>,
pub translate: Option<[Size; 2]>,
pub anchor: Option<[Size; 2]>,
pub scale: Option<[Size; 2]>,
pub skew: Option<[Rotation; 2]>,
}
Expand description
A sugary representation of an Affine transform+, including
anchor
and align
as layout-computed properties.
translate
represents an (x,y) affine translation
scale
represents an (x,y) non-uniform affine scale
rotate
represents a (z) affine rotation (intuitive 2D rotation)
anchor
represents the “(0,0)” point of the render node as it relates to its own bounding box.
By default that’s the top-left of the element, but anchor
allows that
to be offset either by a pixel or percentage-of-element-size
for each of (x,y)
Fields§
§previous: Option<Box<Transform2D>>
Keeps track of a linked list of previous Transform2Ds, assembled e.g. via multiplication
rotate: Option<Rotation>
Rotation is single-dimensional for 2D rendering, representing rotation over z axis
translate: Option<[Size; 2]>
§anchor: Option<[Size; 2]>
§scale: Option<[Size; 2]>
§skew: Option<[Rotation; 2]>
Implementations§
source§impl Transform2D
impl Transform2D
sourcepub fn scale(x: Size, y: Size) -> Transform2D
pub fn scale(x: Size, y: Size) -> Transform2D
Scale coefficients (1.0 == 100%) over x-y plane
sourcepub fn rotate(z: Rotation) -> Transform2D
pub fn rotate(z: Rotation) -> Transform2D
Rotation over z axis
sourcepub fn translate(x: Size, y: Size) -> Transform2D
pub fn translate(x: Size, y: Size) -> Transform2D
Translation across x-y plane, pixels
sourcepub fn anchor(x: Size, y: Size) -> Transform2D
pub fn anchor(x: Size, y: Size) -> Transform2D
Describe alignment of the (0,0) position of this element as it relates to its own bounding box
Trait Implementations§
source§impl Clone for Transform2D
impl Clone for Transform2D
source§fn clone(&self) -> Transform2D
fn clone(&self) -> Transform2D
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl CoercionRules for Transform2D
impl CoercionRules for Transform2D
fn try_coerce(pax_value: PaxValue) -> Result<Transform2D, String>
source§impl ComputableTransform<NodeLocal, Window> for Transform2D
impl ComputableTransform<NodeLocal, Window> for Transform2D
fn apply( &self, bounds: TransformAndBounds<NodeLocal, Window>, ) -> TransformAndBounds<NodeLocal, Window>
source§impl Debug for Transform2D
impl Debug for Transform2D
source§impl Default for Transform2D
impl Default for Transform2D
source§fn default() -> Transform2D
fn default() -> Transform2D
source§impl<'de> Deserialize<'de> for Transform2D
impl<'de> Deserialize<'de> for Transform2D
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Transform2D, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Transform2D, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl Interpolatable for Transform2D
impl Interpolatable for Transform2D
fn interpolate(&self, _other: &Self, _t: f64) -> Self
source§impl Mul for Transform2D
impl Mul for Transform2D
§type Output = Transform2D
type Output = Transform2D
*
operator.source§fn mul(self, rhs: Transform2D) -> <Transform2D as Mul>::Output
fn mul(self, rhs: Transform2D) -> <Transform2D as Mul>::Output
*
operation. Read moresource§impl Serialize for Transform2D
impl Serialize for Transform2D
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl ToFromPaxAny for Transform2D
impl ToFromPaxAny for Transform2D
fn to_pax_any(self) -> PaxAny
fn from_pax_any(pax_any: PaxAny) -> Result<Transform2D, String>
fn ref_from_pax_any(pax_any: &PaxAny) -> Result<&Transform2D, String>
fn mut_from_pax_any(pax_any: &mut PaxAny) -> Result<&mut Transform2D, String>
source§impl ToFromPaxValue for Transform2D
impl ToFromPaxValue for Transform2D
fn to_pax_value(self) -> PaxValue
fn from_pax_value(pax_value: PaxValue) -> Result<Transform2D, String>
fn ref_from_pax_value(pax_value: &PaxValue) -> Result<&Transform2D, String>
fn mut_from_pax_value( pax_value: &mut PaxValue, ) -> Result<&mut Transform2D, String>
Auto Trait Implementations§
impl Freeze for Transform2D
impl RefUnwindSafe for Transform2D
impl Send for Transform2D
impl Sync for Transform2D
impl Unpin for Transform2D
impl UnwindSafe for Transform2D
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,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)