1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use crate::{Matrix, Rectangle};
use glib::translate::*;
use std::fmt;
impl Matrix {
pub fn new(xx: f64, xy: f64, yx: f64, yy: f64, x0: f64, y0: f64) -> Self {
unsafe {
Self::unsafe_from(ffi::PangoMatrix {
xx,
xy,
yx,
yy,
x0,
y0,
})
}
}
#[doc(alias = "pango_matrix_transform_pixel_rectangle")]
pub fn transform_pixel_rectangle(&self, rect: &mut Rectangle) {
unsafe {
ffi::pango_matrix_transform_pixel_rectangle(
self.to_glib_none().0,
rect.to_glib_none_mut().0,
)
}
}
#[doc(alias = "pango_matrix_transform_rectangle")]
pub fn transform_rectangle(&self, rect: &mut Rectangle) {
unsafe {
ffi::pango_matrix_transform_rectangle(self.to_glib_none().0, rect.to_glib_none_mut().0)
}
}
pub fn xx(&self) -> f64 {
self.inner.xx
}
pub fn xy(&self) -> f64 {
self.inner.xy
}
pub fn yx(&self) -> f64 {
self.inner.yx
}
pub fn yy(&self) -> f64 {
self.inner.yy
}
pub fn x0(&self) -> f64 {
self.inner.x0
}
pub fn y0(&self) -> f64 {
self.inner.y0
}
}
impl fmt::Debug for Matrix {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Matrix")
.field("xx", &self.xx())
.field("xy", &self.xy())
.field("yx", &self.yx())
.field("yy", &self.yy())
.field("x0", &self.x0())
.field("y0", &self.y0())
.finish()
}
}