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
75
76
77
78
use ffi;
use glib::translate::*;
#[cfg(feature = "v1_38")]
use std::mem;
glib_wrapper! {
pub struct Matrix(Boxed<ffi::PangoMatrix>);
match fn {
copy => |ptr| ffi::pango_matrix_copy(mut_override(ptr)),
free => |ptr| ffi::pango_matrix_free(ptr),
}
}
impl Matrix {
pub fn concat(&mut self, new_matrix: &Matrix) {
unsafe {
ffi::pango_matrix_concat(self.to_glib_none_mut().0, new_matrix.to_glib_none().0);
}
}
pub fn get_font_scale_factor(&self) -> f64 {
unsafe {
ffi::pango_matrix_get_font_scale_factor(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_38")]
pub fn get_font_scale_factors(&self) -> (f64, f64) {
unsafe {
let mut xscale = mem::uninitialized();
let mut yscale = mem::uninitialized();
ffi::pango_matrix_get_font_scale_factors(self.to_glib_none().0, &mut xscale, &mut yscale);
(xscale, yscale)
}
}
pub fn rotate(&mut self, degrees: f64) {
unsafe {
ffi::pango_matrix_rotate(self.to_glib_none_mut().0, degrees);
}
}
pub fn scale(&mut self, scale_x: f64, scale_y: f64) {
unsafe {
ffi::pango_matrix_scale(self.to_glib_none_mut().0, scale_x, scale_y);
}
}
pub fn transform_distance(&self, dx: &mut f64, dy: &mut f64) {
unsafe {
ffi::pango_matrix_transform_distance(self.to_glib_none().0, dx, dy);
}
}
pub fn transform_point(&self, x: &mut f64, y: &mut f64) {
unsafe {
ffi::pango_matrix_transform_point(self.to_glib_none().0, x, y);
}
}
pub fn translate(&mut self, tx: f64, ty: f64) {
unsafe {
ffi::pango_matrix_translate(self.to_glib_none_mut().0, tx, ty);
}
}
}