1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use glib::translate::*; 6 use std::mem; 7 8 glib::wrapper! { 9 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 10 pub struct Matrix(Boxed<ffi::PangoMatrix>); 11 12 match fn { 13 copy => |ptr| ffi::pango_matrix_copy(ptr), 14 free => |ptr| ffi::pango_matrix_free(ptr), 15 type_ => || ffi::pango_matrix_get_type(), 16 } 17 } 18 19 impl Matrix { 20 #[doc(alias = "pango_matrix_concat")] concat(&mut self, new_matrix: &Matrix)21 pub fn concat(&mut self, new_matrix: &Matrix) { 22 unsafe { 23 ffi::pango_matrix_concat(self.to_glib_none_mut().0, new_matrix.to_glib_none().0); 24 } 25 } 26 27 #[doc(alias = "pango_matrix_get_font_scale_factor")] 28 #[doc(alias = "get_font_scale_factor")] font_scale_factor(&self) -> f6429 pub fn font_scale_factor(&self) -> f64 { 30 unsafe { ffi::pango_matrix_get_font_scale_factor(self.to_glib_none().0) } 31 } 32 33 #[doc(alias = "pango_matrix_get_font_scale_factors")] 34 #[doc(alias = "get_font_scale_factors")] font_scale_factors(&self) -> (f64, f64)35 pub fn font_scale_factors(&self) -> (f64, f64) { 36 unsafe { 37 let mut xscale = mem::MaybeUninit::uninit(); 38 let mut yscale = mem::MaybeUninit::uninit(); 39 ffi::pango_matrix_get_font_scale_factors( 40 self.to_glib_none().0, 41 xscale.as_mut_ptr(), 42 yscale.as_mut_ptr(), 43 ); 44 let xscale = xscale.assume_init(); 45 let yscale = yscale.assume_init(); 46 (xscale, yscale) 47 } 48 } 49 50 #[doc(alias = "pango_matrix_rotate")] rotate(&mut self, degrees: f64)51 pub fn rotate(&mut self, degrees: f64) { 52 unsafe { 53 ffi::pango_matrix_rotate(self.to_glib_none_mut().0, degrees); 54 } 55 } 56 57 #[doc(alias = "pango_matrix_scale")] scale(&mut self, scale_x: f64, scale_y: f64)58 pub fn scale(&mut self, scale_x: f64, scale_y: f64) { 59 unsafe { 60 ffi::pango_matrix_scale(self.to_glib_none_mut().0, scale_x, scale_y); 61 } 62 } 63 64 #[doc(alias = "pango_matrix_transform_distance")] transform_distance(&self, dx: &mut f64, dy: &mut f64)65 pub fn transform_distance(&self, dx: &mut f64, dy: &mut f64) { 66 unsafe { 67 ffi::pango_matrix_transform_distance(self.to_glib_none().0, dx, dy); 68 } 69 } 70 71 //#[doc(alias = "pango_matrix_transform_pixel_rectangle")] 72 //pub fn transform_pixel_rectangle(&self, rect: /*Unimplemented*/Option<Rectangle>) { 73 // unsafe { TODO: call ffi:pango_matrix_transform_pixel_rectangle() } 74 //} 75 76 #[doc(alias = "pango_matrix_transform_point")] transform_point(&self, x: &mut f64, y: &mut f64)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_transform_rectangle")] 84 //pub fn transform_rectangle(&self, rect: /*Unimplemented*/Option<Rectangle>) { 85 // unsafe { TODO: call ffi:pango_matrix_transform_rectangle() } 86 //} 87 88 #[doc(alias = "pango_matrix_translate")] translate(&mut self, tx: f64, ty: f64)89 pub fn translate(&mut self, tx: f64, ty: f64) { 90 unsafe { 91 ffi::pango_matrix_translate(self.to_glib_none_mut().0, tx, ty); 92 } 93 } 94 } 95