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
79
80
81
82
83
84
85
86
87
88
89
use glib::translate::*;
use std::mem;
glib::wrapper! {
pub struct Matrix(BoxedInline<ffi::PangoMatrix>);
match fn {
copy => |ptr| ffi::pango_matrix_copy(ptr),
free => |ptr| ffi::pango_matrix_free(ptr),
type_ => || ffi::pango_matrix_get_type(),
}
}
impl Matrix {
#[doc(alias = "pango_matrix_concat")]
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);
}
}
#[doc(alias = "pango_matrix_get_font_scale_factor")]
#[doc(alias = "get_font_scale_factor")]
pub fn font_scale_factor(&self) -> f64 {
unsafe { ffi::pango_matrix_get_font_scale_factor(self.to_glib_none().0) }
}
#[doc(alias = "pango_matrix_get_font_scale_factors")]
#[doc(alias = "get_font_scale_factors")]
pub fn font_scale_factors(&self) -> (f64, f64) {
unsafe {
let mut xscale = mem::MaybeUninit::uninit();
let mut yscale = mem::MaybeUninit::uninit();
ffi::pango_matrix_get_font_scale_factors(
self.to_glib_none().0,
xscale.as_mut_ptr(),
yscale.as_mut_ptr(),
);
(xscale.assume_init(), yscale.assume_init())
}
}
#[cfg(any(feature = "v1_50", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_50")))]
#[doc(alias = "pango_matrix_get_slant_ratio")]
#[doc(alias = "get_slant_ratio")]
pub fn slant_ratio(&self) -> f64 {
unsafe { ffi::pango_matrix_get_slant_ratio(self.to_glib_none().0) }
}
#[doc(alias = "pango_matrix_rotate")]
pub fn rotate(&mut self, degrees: f64) {
unsafe {
ffi::pango_matrix_rotate(self.to_glib_none_mut().0, degrees);
}
}
#[doc(alias = "pango_matrix_scale")]
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);
}
}
#[doc(alias = "pango_matrix_transform_distance")]
pub fn transform_distance(&self, dx: &mut f64, dy: &mut f64) {
unsafe {
ffi::pango_matrix_transform_distance(self.to_glib_none().0, dx, dy);
}
}
#[doc(alias = "pango_matrix_transform_point")]
pub fn transform_point(&self, x: &mut f64, y: &mut f64) {
unsafe {
ffi::pango_matrix_transform_point(self.to_glib_none().0, x, y);
}
}
#[doc(alias = "pango_matrix_translate")]
pub fn translate(&mut self, tx: f64, ty: f64) {
unsafe {
ffi::pango_matrix_translate(self.to_glib_none_mut().0, tx, ty);
}
}
}