pub struct Matrix {
pub a: f64,
pub b: f64,
pub c: f64,
pub d: f64,
pub e: f64,
pub f: f64,
}Expand description
2D affine transform in PDF row-vector convention: (x' y' 1) = (x y 1) x M. Used for both the
graphics-state CTM (cm/q/Q) and the text matrix/text-line matrix (Tm/Td/TD/T*).
Fields§
§a: f64§b: f64§c: f64§d: f64§e: f64§f: f64Implementations§
Source§impl Matrix
impl Matrix
pub const IDENTITY: Matrix
pub fn translation(tx: f64, ty: f64) -> Matrix
Sourcepub fn then(self, other: Matrix) -> Matrix
pub fn then(self, other: Matrix) -> Matrix
self composed with (applied before) other: self x other.
Sourcepub fn transform(self, point: (f64, f64)) -> (f64, f64)
pub fn transform(self, point: (f64, f64)) -> (f64, f64)
Transforms point (row vector) through this matrix.
Sourcepub fn origin(self) -> (f64, f64)
pub fn origin(self) -> (f64, f64)
This matrix’s translation component — for a text matrix, the run’s PDF-space origin.
Sourcepub fn translate_text(&mut self, tx: f64, ty: f64)
pub fn translate_text(&mut self, tx: f64, ty: f64)
Post-show horizontal advance (PDF spec 9.4.3): self = [1 0 0 1 tx ty] x self.
Trait Implementations§
impl Copy for Matrix
impl StructuralPartialEq for Matrix
Auto Trait Implementations§
impl Freeze for Matrix
impl RefUnwindSafe for Matrix
impl Send for Matrix
impl Sync for Matrix
impl Unpin for Matrix
impl UnsafeUnpin for Matrix
impl UnwindSafe for Matrix
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,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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.