pub struct TransformMatrix {
pub a: f64,
pub b: f64,
pub c: f64,
pub d: f64,
pub e: f64,
pub f: f64,
}Expand description
2D transformation matrix in homogeneous coordinates
Represents a 3x3 matrix in the form:
[a c e] [x] [ax + cy + e]
[b d f] × [y] = [bx + dy + f]
[0 0 1] [1] [ 1 ]Common transformations:
- Identity:
a=1, b=0, c=0, d=1, e=0, f=0 - Translation:
a=1, b=0, c=0, d=1, e=tx, f=ty - Scale:
a=sx, b=0, c=0, d=sy, e=0, f=0 - Y-flip:
a=1, b=0, c=0, d=-1, e=0, f=page_height
Fields§
§a: f64Scale/rotation X component
b: f64Skew Y component
c: f64Skew X component
d: f64Scale/rotation Y component
e: f64Translation X component
f: f64Translation Y component
Implementations§
Source§impl TransformMatrix
impl TransformMatrix
Sourcepub fn new(a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) -> Self
pub fn new(a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) -> Self
Create a new transformation matrix
Sourcepub fn flip_y(page_height: f64) -> Self
pub fn flip_y(page_height: f64) -> Self
Create Y-axis flip transformation for given page height
Sourcepub fn multiply(&self, other: &TransformMatrix) -> Self
pub fn multiply(&self, other: &TransformMatrix) -> Self
Matrix multiplication: self * other
Sourcepub fn transform_point(&self, point: Point) -> Point
pub fn transform_point(&self, point: Point) -> Point
Transform a point using this matrix
Sourcepub fn to_pdf_ctm(&self) -> String
pub fn to_pdf_ctm(&self) -> String
Convert to PDF CTM (Current Transformation Matrix) string
Trait Implementations§
Source§impl Clone for TransformMatrix
impl Clone for TransformMatrix
Source§fn clone(&self) -> TransformMatrix
fn clone(&self) -> TransformMatrix
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TransformMatrix
impl Debug for TransformMatrix
Source§impl PartialEq for TransformMatrix
impl PartialEq for TransformMatrix
impl Copy for TransformMatrix
impl StructuralPartialEq for TransformMatrix
Auto Trait Implementations§
impl Freeze for TransformMatrix
impl RefUnwindSafe for TransformMatrix
impl Send for TransformMatrix
impl Sync for TransformMatrix
impl Unpin for TransformMatrix
impl UnwindSafe for TransformMatrix
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