pub struct Matrix<P> {
pub a: P,
pub b: P,
pub c: P,
pub d: P,
pub e: P,
pub f: P,
}Expand description
A font matrix
⎛ a b 0 ⎞ ⎜ c d 0 ⎟ ⎝ e f 1 ⎠
Fields§
§a: PM1,1
b: PM1,2
c: PM2,1
d: PM2,2
e: PM3,1
f: PM3,2
Implementations§
Source§impl Matrix<f32>
A matrix
impl Matrix<f32>
A matrix
Sourcepub fn identity() -> Self
pub fn identity() -> Self
use pdf_create::common::Matrix;
let id = Matrix::<f32>::identity();
assert_eq!(id, id * id);Sourcepub fn inverse_y() -> Self
pub fn inverse_y() -> Self
use pdf_create::common::Matrix;
let id = Matrix::<f32>::identity();
let ivy = Matrix::<f32>::inverse_y();
assert_eq!(ivy, ivy * id);
assert_eq!(id, ivy * ivy);Sourcepub fn inverse_x() -> Self
pub fn inverse_x() -> Self
use pdf_create::common::Matrix;
let id = Matrix::<f32>::identity();
let ivx = Matrix::<f32>::inverse_x();
assert_eq!(ivx, ivx * id);
assert_eq!(id, ivx * ivx);Sourcepub fn inverse_xy() -> Self
pub fn inverse_xy() -> Self
Inverts both coordinates
Sourcepub fn translate(x: f32, y: f32) -> Self
pub fn translate(x: f32, y: f32) -> Self
use pdf_create::common::Matrix;
let ty1 = Matrix::<f32>::translate(0.0, 3.0);
let ty2 = Matrix::<f32>::translate(0.0, 5.0);
let tx1 = Matrix::<f32>::translate(2.0, 0.0);
let tx2 = Matrix::<f32>::translate(7.0, 0.0);
let res = Matrix::<f32>::translate(9.0, 8.0);
assert_eq!(res, ty1 * ty2 * tx1 * tx2);
assert_eq!(res, ty1 * tx2 * ty2 * tx1);Sourcepub fn default_glyph() -> Self
pub fn default_glyph() -> Self
Create a default 1:1000 glyph matrix
Trait Implementations§
impl<P: Copy> Copy for Matrix<P>
impl<P: Eq> Eq for Matrix<P>
impl<P> StructuralPartialEq for Matrix<P>
Auto Trait Implementations§
impl<P> Freeze for Matrix<P>where
P: Freeze,
impl<P> RefUnwindSafe for Matrix<P>where
P: RefUnwindSafe,
impl<P> Send for Matrix<P>where
P: Send,
impl<P> Sync for Matrix<P>where
P: Sync,
impl<P> Unpin for Matrix<P>where
P: Unpin,
impl<P> UnwindSafe for Matrix<P>where
P: 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