1use crate::ffi;
6use glib::translate::*;
7
8glib::wrapper! {
9 pub struct Matrix(BoxedInline<ffi::PangoMatrix>);
10
11 match fn {
12 copy => |ptr| ffi::pango_matrix_copy(ptr),
13 free => |ptr| ffi::pango_matrix_free(ptr),
14 type_ => || ffi::pango_matrix_get_type(),
15 }
16}
17
18impl Matrix {
19 #[doc(alias = "pango_matrix_concat")]
20 pub fn concat(&mut self, new_matrix: &Matrix) {
21 unsafe {
22 ffi::pango_matrix_concat(self.to_glib_none_mut().0, new_matrix.to_glib_none().0);
23 }
24 }
25
26 #[doc(alias = "pango_matrix_get_font_scale_factor")]
27 #[doc(alias = "get_font_scale_factor")]
28 pub fn font_scale_factor(&self) -> f64 {
29 unsafe { ffi::pango_matrix_get_font_scale_factor(self.to_glib_none().0) }
30 }
31
32 #[doc(alias = "pango_matrix_get_font_scale_factors")]
33 #[doc(alias = "get_font_scale_factors")]
34 pub fn font_scale_factors(&self) -> (f64, f64) {
35 unsafe {
36 let mut xscale = std::mem::MaybeUninit::uninit();
37 let mut yscale = std::mem::MaybeUninit::uninit();
38 ffi::pango_matrix_get_font_scale_factors(
39 self.to_glib_none().0,
40 xscale.as_mut_ptr(),
41 yscale.as_mut_ptr(),
42 );
43 (xscale.assume_init(), yscale.assume_init())
44 }
45 }
46
47 #[cfg(feature = "v1_50")]
48 #[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
49 #[doc(alias = "pango_matrix_get_slant_ratio")]
50 #[doc(alias = "get_slant_ratio")]
51 pub fn slant_ratio(&self) -> f64 {
52 unsafe { ffi::pango_matrix_get_slant_ratio(self.to_glib_none().0) }
53 }
54
55 #[doc(alias = "pango_matrix_rotate")]
56 pub fn rotate(&mut self, degrees: f64) {
57 unsafe {
58 ffi::pango_matrix_rotate(self.to_glib_none_mut().0, degrees);
59 }
60 }
61
62 #[doc(alias = "pango_matrix_scale")]
63 pub fn scale(&mut self, scale_x: f64, scale_y: f64) {
64 unsafe {
65 ffi::pango_matrix_scale(self.to_glib_none_mut().0, scale_x, scale_y);
66 }
67 }
68
69 #[doc(alias = "pango_matrix_transform_distance")]
70 pub fn transform_distance(&self, dx: &mut f64, dy: &mut f64) {
71 unsafe {
72 ffi::pango_matrix_transform_distance(self.to_glib_none().0, dx, dy);
73 }
74 }
75
76 #[doc(alias = "pango_matrix_transform_point")]
77 pub fn transform_point(&self, x: &mut f64, y: &mut f64) {
78 unsafe {
79 ffi::pango_matrix_transform_point(self.to_glib_none().0, x, y);
80 }
81 }
82
83 #[doc(alias = "pango_matrix_translate")]
84 pub fn translate(&mut self, tx: f64, ty: f64) {
85 unsafe {
86 ffi::pango_matrix_translate(self.to_glib_none_mut().0, tx, ty);
87 }
88 }
89}