cogl/auto/
fixed.rs

1use glib::translate::*;
2use std::fmt;
3
4glib_wrapper! {
5    pub struct Fixed(Object<ffi::CoglFixed, FixedClass>);
6
7    match fn {
8        get_type => || ffi::cogl_fixed_get_type(),
9    }
10}
11
12impl Fixed {
13    // TODO: remade all it here coz
14    // typedef int32_t CoglFixed;
15
16    // /// Computes the arc tangent of `self`.
17    // ///
18    // /// # Returns
19    // ///
20    // /// the arc tangent of the passed value, in fixed point notation
21    // pub fn atan(&self) -> Option<Fixed> {
22    //     let a: ffi::CoglFixed = self.to_glib_none().0;
23    //     unsafe {
24    //         from_glib_none(ffi::cogl_fixed_atan(self.to_glib_none().0))
25    //     }
26    // }
27
28    // /// Computes the arc tangent of `self` / `b` but uses the sign of both
29    // /// arguments to return the angle in right quadrant.
30    // /// ## `b`
31    // /// the denominator as a `Fixed` number
32    // ///
33    // /// # Returns
34    // ///
35    // /// the arc tangent of the passed fraction, in fixed point
36    // ///  notation
37    // pub fn atan2(&self, b: &Fixed) -> Option<Fixed> {
38    //     unsafe {
39    //         from_glib_none(ffi::cogl_fixed_atan2(self.to_glib_none().0, b.to_glib_none().0))
40    //     }
41    // }
42
43    // /// Computes the cosine of `self`.
44    // ///
45    // /// # Returns
46    // ///
47    // /// the cosine of the passed angle, in fixed point notation
48    // pub fn cos(&self) -> Option<Fixed> {
49    //     unsafe {
50    //         from_glib_none(ffi::cogl_fixed_cos(self.to_glib_none().0))
51    //     }
52    // }
53
54    // /// Calculates 2 to the `self` power.
55    // ///
56    // /// This function is around 11 times faster on x86, and around 22 times faster
57    // /// on fpu-less arm than libc pow(2, x).
58    // ///
59    // /// # Returns
60    // ///
61    // /// the power of 2 to the passed value
62    // pub fn pow2(&self) -> u32 {
63    //     unsafe {
64    //         ffi::cogl_fixed_pow2(self.to_glib_none().0)
65    //     }
66    // }
67
68    // /// Computes the sine of `self`.
69    // ///
70    // /// # Returns
71    // ///
72    // /// the sine of the passed angle, in fixed point notation
73    // pub fn sin(&self) -> Option<Fixed> {
74    //     unsafe {
75    //         from_glib_none(ffi::cogl_fixed_sin(self.to_glib_none().0))
76    //     }
77    // }
78
79    // /// Computes the square root of `self`.
80    // ///
81    // /// # Returns
82    // ///
83    // /// the square root of the passed value, in floating point
84    // ///  notation
85    // pub fn sqrt(&self) -> Option<Fixed> {
86    //     unsafe {
87    //         from_glib_none(ffi::cogl_fixed_sqrt(self.to_glib_none().0))
88    //     }
89    // }
90
91    // /// Computes the tangent of `self`.
92    // ///
93    // /// # Returns
94    // ///
95    // /// the tangent of the passed angle, in fixed point notation
96    // pub fn tan(&self) -> Option<Fixed> {
97    //     unsafe {
98    //         from_glib_none(ffi::cogl_fixed_tan(self.to_glib_none().0))
99    //     }
100    // }
101
102    // /// Calculates base 2 logarithm.
103    // ///
104    // /// This function is some 2.5 times faster on x86, and over 12 times faster on
105    // /// fpu-less arm, than using libc `log`.
106    // /// ## `x`
107    // /// value to calculate base 2 logarithm from
108    // ///
109    // /// # Returns
110    // ///
111    // /// base 2 logarithm.
112    // pub fn log2(x: u32) -> Option<Fixed> {
113    //     unsafe {
114    //         from_glib_none(ffi::cogl_fixed_log2(x))
115    //     }
116    // }
117
118    // /// Calculates `x` to the `y` power.
119    // /// ## `x`
120    // /// base
121    // /// ## `y`
122    // /// `Fixed` exponent
123    // ///
124    // /// # Returns
125    // ///
126    // /// the power of `x` to the `y`
127    // pub fn pow(x: u32, y: &Fixed) -> u32 {
128    //     unsafe {
129    //         ffi::cogl_fixed_pow(x, y.to_glib_none().0)
130    //     }
131    // }
132}
133
134impl fmt::Display for Fixed {
135    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
136        write!(f, "Fixed")
137    }
138}