pango/auto/
matrix.rs

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
5use glib::translate::*;
6use pango_sys;
7#[cfg(any(feature = "v1_38", feature = "dox"))]
8use std::mem;
9
10glib_wrapper! {
11    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
12    pub struct Matrix(Boxed<pango_sys::PangoMatrix>);
13
14    match fn {
15        copy => |ptr| pango_sys::pango_matrix_copy(mut_override(ptr)),
16        free => |ptr| pango_sys::pango_matrix_free(ptr),
17        get_type => || pango_sys::pango_matrix_get_type(),
18    }
19}
20
21impl Matrix {
22    pub fn concat(&mut self, new_matrix: &Matrix) {
23        unsafe {
24            pango_sys::pango_matrix_concat(self.to_glib_none_mut().0, new_matrix.to_glib_none().0);
25        }
26    }
27
28    pub fn get_font_scale_factor(&self) -> f64 {
29        unsafe { pango_sys::pango_matrix_get_font_scale_factor(self.to_glib_none().0) }
30    }
31
32    #[cfg(any(feature = "v1_38", feature = "dox"))]
33    pub fn get_font_scale_factors(&self) -> (f64, f64) {
34        unsafe {
35            let mut xscale = mem::uninitialized();
36            let mut yscale = mem::uninitialized();
37            pango_sys::pango_matrix_get_font_scale_factors(
38                self.to_glib_none().0,
39                &mut xscale,
40                &mut yscale,
41            );
42            (xscale, yscale)
43        }
44    }
45
46    pub fn rotate(&mut self, degrees: f64) {
47        unsafe {
48            pango_sys::pango_matrix_rotate(self.to_glib_none_mut().0, degrees);
49        }
50    }
51
52    pub fn scale(&mut self, scale_x: f64, scale_y: f64) {
53        unsafe {
54            pango_sys::pango_matrix_scale(self.to_glib_none_mut().0, scale_x, scale_y);
55        }
56    }
57
58    pub fn transform_distance(&self, dx: &mut f64, dy: &mut f64) {
59        unsafe {
60            pango_sys::pango_matrix_transform_distance(self.to_glib_none().0, dx, dy);
61        }
62    }
63
64    //pub fn transform_pixel_rectangle(&self, rect: /*Unimplemented*/Option<Rectangle>) {
65    //    unsafe { TODO: call pango_sys:pango_matrix_transform_pixel_rectangle() }
66    //}
67
68    pub fn transform_point(&self, x: &mut f64, y: &mut f64) {
69        unsafe {
70            pango_sys::pango_matrix_transform_point(self.to_glib_none().0, x, y);
71        }
72    }
73
74    //pub fn transform_rectangle(&self, rect: /*Unimplemented*/Option<Rectangle>) {
75    //    unsafe { TODO: call pango_sys:pango_matrix_transform_rectangle() }
76    //}
77
78    pub fn translate(&mut self, tx: f64, ty: f64) {
79        unsafe {
80            pango_sys::pango_matrix_translate(self.to_glib_none_mut().0, tx, ty);
81        }
82    }
83}