pub struct Transform {
pub a: i64,
pub b: i64,
pub c: i64,
pub d: i64,
pub tx: Unit,
pub ty: Unit,
}Expand description
Fixed-point affine transform using millionth scale coefficients.
Fields§
§a: i64Horizontal scale/rotation coefficient.
b: i64Vertical shear/rotation coefficient.
c: i64Horizontal shear/rotation coefficient.
d: i64Vertical scale/rotation coefficient.
tx: UnitHorizontal translation.
ty: UnitVertical translation.
Implementations§
Source§impl Transform
impl Transform
Sourcepub const fn translation(tx: Unit, ty: Unit) -> Self
pub const fn translation(tx: Unit, ty: Unit) -> Self
Creates a checked page-space translation.
Sourcepub fn scale(x: i64, y: i64) -> Result<Self>
pub fn scale(x: i64, y: i64) -> Result<Self>
Creates a fixed-point scale. Negative coefficients mirror an axis.
Sourcepub fn rotation_degrees(degrees: i32) -> Result<Self>
pub fn rotation_degrees(degrees: i32) -> Result<Self>
Creates an integer-degree rotation quantized to millionth coefficients.
Sourcepub fn then(self, next: Self) -> Result<Self>
pub fn then(self, next: Self) -> Result<Self>
Applies self, then next, using checked fixed-point matrix composition.
Sourcepub fn around(self, origin: Point) -> Result<Self>
pub fn around(self, origin: Point) -> Result<Self>
Applies this linear transform around an explicit page-space origin.
Sourcepub const fn is_identity(self) -> bool
pub const fn is_identity(self) -> bool
Whether the transform leaves page coordinates unchanged.
Sourcepub fn inverse_vector(self, vector: Point) -> Result<Point>
pub fn inverse_vector(self, vector: Point) -> Result<Point>
Maps a page-space displacement back through the linear matrix.
Trait Implementations§
impl Copy for Transform
Source§impl<'de> Deserialize<'de> for Transform
impl<'de> Deserialize<'de> for Transform
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations§
impl Freeze for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnsafeUnpin for Transform
impl UnwindSafe for Transform
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.