graphene-rs-0.14.8/.cargo_vcs_info.json0000644000000001120000000000100133330ustar { "git": { "sha1": "9364a9538de344056ea14c2678229f76b197161e" } } graphene-rs-0.14.8/COPYRIGHT000064400000000000000000000012130072674642500134510ustar 00000000000000The gtk-rs Project is licensed under the MIT license, see the LICENSE file or . Copyrights in the gtk-rs Project project are retained by their contributors. No copyright assignment is required to contribute to the gtk-rs Project project. For full authorship information, see the version control history. This project provides interoperability with various GNOME libraries but doesn't distribute any parts of them. Distributing compiled libraries and executables that link to those libraries may be subject to terms of the GNU LGPL or other licenses. For more information check the license of each GNOME library. graphene-rs-0.14.8/Cargo.toml0000644000000023170000000000100113420ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "graphene-rs" version = "0.14.8" authors = ["The gtk-rs Project Developers"] exclude = ["gir-files/*"] description = "Rust bindings for the Graphene library" homepage = "https://gtk-rs.org/" documentation = "https://gtk-rs.org/gtk-rs-core/stable/latest/docs/graphene/" readme = "README.md" keywords = ["graphene", "graphene-rs", "gtk-rs", "gnome", "GUI"] license = "MIT" repository = "https://github.com/gtk-rs/gtk-rs-core" [package.metadata.docs.rs] features = ["dox"] [lib] name = "graphene" [dependencies.ffi] version = "0.14.8" package = "graphene-sys" [dependencies.glib] version = "0.14.0" [dependencies.libc] version = "0.2" [dev-dependencies.gir-format-check] version = "^0.1" [features] dox = ["ffi/dox", "glib/dox"] graphene-rs-0.14.8/Cargo.toml.orig000064400000000000000000000014010072674642500150440ustar 00000000000000[package] name = "graphene-rs" license = "MIT" homepage = "https://gtk-rs.org/" authors = ["The gtk-rs Project Developers"] keywords = ["graphene", "graphene-rs", "gtk-rs", "gnome", "GUI"] readme = "README.md" documentation = "https://gtk-rs.org/gtk-rs-core/stable/latest/docs/graphene/" version = "0.14.8" description = "Rust bindings for the Graphene library" repository = "https://github.com/gtk-rs/gtk-rs-core" exclude = [ "gir-files/*", ] edition = "2018" [lib] name = "graphene" [features] dox = ["ffi/dox", "glib/dox"] [package.metadata.docs.rs] features = ["dox"] [dependencies] libc = "0.2" glib = {version = "0.14.0", path = "../glib"} ffi = {package = "graphene-sys", path = "./sys", version = "0.14.8"} [dev-dependencies] gir-format-check = "^0.1" graphene-rs-0.14.8/Gir.toml000064400000000000000000000341570072674642500136110ustar 00000000000000[options] girs_directories = ["../gir-files"] library = "Graphene" version = "1.0" min_cfg_version = "1.10" target_path = "." work_mode = "normal" generate_safety_asserts = true single_version_file = true deprecate_by_min_version = true generate = [ "Graphene.EulerOrder", "Graphene.RayIntersectionKind", ] [[object]] name = "Graphene.*" status = "generate" [[object.constant]] name = "SIMD_S" ignore = true [[object]] name = "Graphene.Box" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_box" [object.function.return] type = "none" [[object.function]] # array with size name = "init_from_points" manual = true [object.function.return] type = "none" [[object.function]] name = "init_from_vec3" [object.function.return] type = "none" [[object.function]] # array with size name = "init_from_vectors" manual = true [object.function.return] type = "none" [[object.function]] name = "zero" [object.function.return] nullable = false [[object.function]] name = "one" [object.function.return] nullable = false [[object.function]] name = "minus_one" [object.function.return] nullable = false [[object.function]] name = "one_minus_one" [object.function.return] nullable = false [[object.function]] name = "empty" [object.function.return] nullable = false [[object.function]] name = "infinite" [object.function.return] nullable = false [[object]] name = "Graphene.Euler" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_with_order" [object.function.return] type = "none" [[object.function]] name = "init_from_matrix" [object.function.return] type = "none" [[object.function]] name = "init_from_quaternion" [object.function.return] type = "none" [[object.function]] name = "init_from_vec3" [object.function.return] type = "none" [[object.function]] name = "init_from_euler" [object.function.return] type = "none" [[object]] name = "Graphene.Frustum" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_frustum" [object.function.return] type = "none" [[object.function]] name = "init_from_matrix" [object.function.return] type = "none" [[object]] name = "Graphene.Matrix" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init_identity" [object.function.return] type = "none" [[object.function]] name = "init_from_float" [object.function.return] type = "none" [[object.function]] name = "init_from_vec4" [object.function.return] type = "none" [[object.function]] name = "init_from_matrix" [object.function.return] type = "none" [[object.function]] name = "init_from_2d" [object.function.return] type = "none" [[object.function]] name = "init_perspective" [object.function.return] type = "none" [[object.function]] name = "init_ortho" [object.function.return] type = "none" [[object.function]] name = "init_look_at" [object.function.return] type = "none" [[object.function]] name = "init_frustum" [object.function.return] type = "none" [[object.function]] name = "init_scale" [object.function.return] type = "none" [[object.function]] name = "init_translate" [object.function.return] type = "none" [[object.function]] name = "init_rotate" [object.function.return] type = "none" [[object.function]] name = "init_skew" [object.function.return] type = "none" [[object]] name = "Graphene.Plane" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_plane" [object.function.return] type = "none" [[object.function]] name = "init_from_point" [object.function.return] type = "none" [[object.function]] name = "init_from_points" [object.function.return] type = "none" [[object.function]] name = "init_from_vec4" [object.function.return] type = "none" [[object]] name = "Graphene.Point" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_point" [object.function.return] type = "none" [[object.function]] name = "init_from_vec2" [object.function.return] type = "none" [[object.function]] name = "zero" [object.function.return] nullable = false [[object]] name = "Graphene.Point3D" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_point" [object.function.return] type = "none" [[object.function]] name = "init_from_vec3" [object.function.return] type = "none" [[object.function]] name = "zero" [object.function.return] nullable = false [[object]] name = "Graphene.Quad" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_rect" [object.function.return] type = "none" [[object.function]] name = "init_from_points" [object.function.return] type = "none" [[object]] name = "Graphene.Quaternion" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_identity" [object.function.return] type = "none" [[object.function]] name = "init_from_quaternion" [object.function.return] type = "none" [[object.function]] name = "init_from_vec4" [object.function.return] type = "none" [[object.function]] name = "init_from_matrix" [object.function.return] type = "none" [[object.function]] name = "init_from_angles" [object.function.return] type = "none" [[object.function]] name = "init_from_radians" [object.function.return] type = "none" [[object.function]] name = "init_from_angle_vec3" [object.function.return] type = "none" [[object.function]] name = "init_from_euler" [object.function.return] type = "none" [[object]] name = "Graphene.Ray" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_ray" [object.function.return] type = "none" [[object.function]] name = "init_from_vec3" [object.function.return] type = "none" [[object]] name = "Graphene.Rect" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_rect" [object.function.return] type = "none" [[object.function]] name = "zero" [object.function.return] nullable = false [[object]] # missing memory management functions name = "Graphene.Simd4F" status = "ignore" [[object]] # missing memory management functions name = "Graphene.Simd4X4F" status = "ignore" [[object]] name = "Graphene.Size" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_size" [object.function.return] type = "none" [[object.function]] name = "zero" [object.function.return] nullable = false [[object]] name = "Graphene.Sphere" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] # array with size name = "init_from_points" manual = true [object.function.return] type = "none" [[object.function]] # array with size name = "init_from_vectors" manual = true [object.function.return] type = "none" [[object]] name = "Graphene.Triangle" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init_from_point3d" [object.function.return] type = "none" [[object.function]] name = "init_from_vec3" [object.function.return] type = "none" [[object]] name = "Graphene.Vec2" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_vec2" [object.function.return] type = "none" [[object.function]] name = "one" [object.function.return] nullable = false [[object.function]] name = "x_axis" [object.function.return] nullable = false [[object.function]] name = "y_axis" [object.function.return] nullable = false [[object.function]] name = "zero" [object.function.return] nullable = false [[object]] name = "Graphene.Vec3" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_vec3" [object.function.return] type = "none" [[object.function]] name = "one" [object.function.return] nullable = false [[object.function]] name = "x_axis" [object.function.return] nullable = false [[object.function]] name = "y_axis" [object.function.return] nullable = false [[object.function]] name = "z_axis" [object.function.return] nullable = false [[object.function]] name = "zero" [object.function.return] nullable = false [[object]] name = "Graphene.Vec4" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] # contents undefined name = "alloc" ignore = true [[object.function]] name = "init" [object.function.return] type = "none" [[object.function]] name = "init_from_vec2" [object.function.return] type = "none" [[object.function]] name = "init_from_vec3" [object.function.return] type = "none" [[object.function]] name = "init_from_vec4" [object.function.return] type = "none" [[object.function]] name = "one" [object.function.return] nullable = false [[object.function]] name = "w_axis" [object.function.return] nullable = false [[object.function]] name = "x_axis" [object.function.return] nullable = false [[object.function]] name = "y_axis" [object.function.return] nullable = false [[object.function]] name = "z_axis" [object.function.return] nullable = false [[object.function]] name = "zero" [object.function.return] nullable = false graphene-rs-0.14.8/LICENSE000064400000000000000000000020000072674642500131560ustar 00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. graphene-rs-0.14.8/README.md000064400000000000000000000022660072674642500134460ustar 00000000000000# graphene __Rust__ bindings and wrappers for __Graphene__, part of [gtk-rs-core](https://github.com/gtk-rs/gtk-rs-core). ## Minimum supported Rust version Currently, the minimum supported Rust version is `1.51.0`. ## Documentation * [Rust API - Stable](https://gtk-rs.org/gtk-rs-core/stable/latest/docs/graphene/) * [Rust API - Development](https://gtk-rs.org/gtk-rs-core/git/docs/graphene) * [C API](https://developer.gnome.org/graphene/stable/) * [GTK Installation instructions](https://www.gtk.org/docs/installations/) ## Using We recommend using [crates from crates.io](https://crates.io/keywords/gtk-rs), as [demonstrated here](https://gtk-rs.org/#using). If you want to track the bleeding edge, use the git dependency instead: ```toml [dependencies] graphene = { git = "https://github.com/gtk-rs/gtk-rs-core.git", package = "graphene" } ``` Avoid mixing versioned and git crates like this: ```toml # This will not compile [dependencies] graphene = "0.13" graphene = { git = "https://github.com/gtk-rs/gtk-rs-core.git", package = "graphene" } ``` ### See Also * [glib](https://crates.io/crates/glib) ## License __graphene__ is available under the MIT License, please refer to it. graphene-rs-0.14.8/src/auto/box_.rs000064400000000000000000000171610072674642500152230ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Point3D; use crate::Sphere; use crate::Vec3; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Box(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_box_get_type(), ptr as *mut _) as *mut ffi::graphene_box_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_box_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_box_get_type(), } } impl Box { #[doc(alias = "graphene_box_contains_box")] pub fn contains_box(&self, b: &Box) -> bool { unsafe { ffi::graphene_box_contains_box(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_box_contains_point")] pub fn contains_point(&self, point: &Point3D) -> bool { unsafe { ffi::graphene_box_contains_point(self.to_glib_none().0, point.to_glib_none().0) } } #[doc(alias = "graphene_box_equal")] fn equal(&self, b: &Box) -> bool { unsafe { ffi::graphene_box_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_box_expand")] pub fn expand(&self, point: &Point3D) -> Box { unsafe { let mut res = Box::uninitialized(); ffi::graphene_box_expand( self.to_glib_none().0, point.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_box_expand_scalar")] pub fn expand_scalar(&self, scalar: f32) -> Box { unsafe { let mut res = Box::uninitialized(); ffi::graphene_box_expand_scalar( self.to_glib_none().0, scalar, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_box_expand_vec3")] pub fn expand_vec3(&self, vec: &Vec3) -> Box { unsafe { let mut res = Box::uninitialized(); ffi::graphene_box_expand_vec3( self.to_glib_none().0, vec.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_box_get_bounding_sphere")] #[doc(alias = "get_bounding_sphere")] pub fn bounding_sphere(&self) -> Sphere { unsafe { let mut sphere = Sphere::uninitialized(); ffi::graphene_box_get_bounding_sphere( self.to_glib_none().0, sphere.to_glib_none_mut().0, ); sphere } } #[doc(alias = "graphene_box_get_center")] #[doc(alias = "get_center")] pub fn center(&self) -> Point3D { unsafe { let mut center = Point3D::uninitialized(); ffi::graphene_box_get_center(self.to_glib_none().0, center.to_glib_none_mut().0); center } } #[doc(alias = "graphene_box_get_depth")] #[doc(alias = "get_depth")] pub fn depth(&self) -> f32 { unsafe { ffi::graphene_box_get_depth(self.to_glib_none().0) } } #[doc(alias = "graphene_box_get_height")] #[doc(alias = "get_height")] pub fn height(&self) -> f32 { unsafe { ffi::graphene_box_get_height(self.to_glib_none().0) } } #[doc(alias = "graphene_box_get_max")] #[doc(alias = "get_max")] pub fn max(&self) -> Point3D { unsafe { let mut max = Point3D::uninitialized(); ffi::graphene_box_get_max(self.to_glib_none().0, max.to_glib_none_mut().0); max } } #[doc(alias = "graphene_box_get_min")] #[doc(alias = "get_min")] pub fn min(&self) -> Point3D { unsafe { let mut min = Point3D::uninitialized(); ffi::graphene_box_get_min(self.to_glib_none().0, min.to_glib_none_mut().0); min } } #[doc(alias = "graphene_box_get_size")] #[doc(alias = "get_size")] pub fn size(&self) -> Vec3 { unsafe { let mut size = Vec3::uninitialized(); ffi::graphene_box_get_size(self.to_glib_none().0, size.to_glib_none_mut().0); size } } //#[doc(alias = "graphene_box_get_vertices")] //#[doc(alias = "get_vertices")] //pub fn vertices(&self, vertices: /*Unimplemented*/FixedArray TypeId { ns_id: 1, id: 0 }; 8) { // unsafe { TODO: call ffi:graphene_box_get_vertices() } //} #[doc(alias = "graphene_box_get_width")] #[doc(alias = "get_width")] pub fn width(&self) -> f32 { unsafe { ffi::graphene_box_get_width(self.to_glib_none().0) } } #[doc(alias = "graphene_box_init")] pub fn init(&mut self, min: Option<&Point3D>, max: Option<&Point3D>) { unsafe { ffi::graphene_box_init( self.to_glib_none_mut().0, min.to_glib_none().0, max.to_glib_none().0, ); } } #[doc(alias = "graphene_box_init_from_box")] pub fn init_from_box(&mut self, src: &Box) { unsafe { ffi::graphene_box_init_from_box(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_box_init_from_vec3")] pub fn init_from_vec3(&mut self, min: Option<&Vec3>, max: Option<&Vec3>) { unsafe { ffi::graphene_box_init_from_vec3( self.to_glib_none_mut().0, min.to_glib_none().0, max.to_glib_none().0, ); } } #[doc(alias = "graphene_box_intersection")] pub fn intersection(&self, b: &Box) -> Option { unsafe { let mut res = Box::uninitialized(); let ret = ffi::graphene_box_intersection( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); if ret { Some(res) } else { None } } } #[doc(alias = "graphene_box_union")] pub fn union(&self, b: &Box) -> Box { unsafe { let mut res = Box::uninitialized(); ffi::graphene_box_union( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_box_empty")] pub fn empty() -> Box { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_box_empty()) } } #[doc(alias = "graphene_box_infinite")] pub fn infinite() -> Box { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_box_infinite()) } } #[doc(alias = "graphene_box_minus_one")] pub fn minus_one() -> Box { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_box_minus_one()) } } #[doc(alias = "graphene_box_one")] pub fn one() -> Box { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_box_one()) } } #[doc(alias = "graphene_box_one_minus_one")] pub fn one_minus_one() -> Box { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_box_one_minus_one()) } } #[doc(alias = "graphene_box_zero")] pub fn zero() -> Box { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_box_zero()) } } } impl PartialEq for Box { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Box {} graphene-rs-0.14.8/src/auto/enums.rs000064400000000000000000000223430072674642500154210ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use glib::translate::*; use std::fmt; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "graphene_euler_order_t")] pub enum EulerOrder { #[doc(alias = "GRAPHENE_EULER_ORDER_DEFAULT")] Default, #[doc(alias = "GRAPHENE_EULER_ORDER_XYZ")] Xyz, #[doc(alias = "GRAPHENE_EULER_ORDER_YZX")] Yzx, #[doc(alias = "GRAPHENE_EULER_ORDER_ZXY")] Zxy, #[doc(alias = "GRAPHENE_EULER_ORDER_XZY")] Xzy, #[doc(alias = "GRAPHENE_EULER_ORDER_YXZ")] Yxz, #[doc(alias = "GRAPHENE_EULER_ORDER_ZYX")] Zyx, #[doc(alias = "GRAPHENE_EULER_ORDER_SXYZ")] Sxyz, #[doc(alias = "GRAPHENE_EULER_ORDER_SXYX")] Sxyx, #[doc(alias = "GRAPHENE_EULER_ORDER_SXZY")] Sxzy, #[doc(alias = "GRAPHENE_EULER_ORDER_SXZX")] Sxzx, #[doc(alias = "GRAPHENE_EULER_ORDER_SYZX")] Syzx, #[doc(alias = "GRAPHENE_EULER_ORDER_SYZY")] Syzy, #[doc(alias = "GRAPHENE_EULER_ORDER_SYXZ")] Syxz, #[doc(alias = "GRAPHENE_EULER_ORDER_SYXY")] Syxy, #[doc(alias = "GRAPHENE_EULER_ORDER_SZXY")] Szxy, #[doc(alias = "GRAPHENE_EULER_ORDER_SZXZ")] Szxz, #[doc(alias = "GRAPHENE_EULER_ORDER_SZYX")] Szyx, #[doc(alias = "GRAPHENE_EULER_ORDER_SZYZ")] Szyz, #[doc(alias = "GRAPHENE_EULER_ORDER_RZYX")] Rzyx, #[doc(alias = "GRAPHENE_EULER_ORDER_RXYX")] Rxyx, #[doc(alias = "GRAPHENE_EULER_ORDER_RYZX")] Ryzx, #[doc(alias = "GRAPHENE_EULER_ORDER_RXZX")] Rxzx, #[doc(alias = "GRAPHENE_EULER_ORDER_RXZY")] Rxzy, #[doc(alias = "GRAPHENE_EULER_ORDER_RYZY")] Ryzy, #[doc(alias = "GRAPHENE_EULER_ORDER_RZXY")] Rzxy, #[doc(alias = "GRAPHENE_EULER_ORDER_RYXY")] Ryxy, #[doc(alias = "GRAPHENE_EULER_ORDER_RYXZ")] Ryxz, #[doc(alias = "GRAPHENE_EULER_ORDER_RZXZ")] Rzxz, #[doc(alias = "GRAPHENE_EULER_ORDER_RXYZ")] Rxyz, #[doc(alias = "GRAPHENE_EULER_ORDER_RZYZ")] Rzyz, #[doc(hidden)] __Unknown(i32), } impl fmt::Display for EulerOrder { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "EulerOrder::{}", match *self { Self::Default => "Default", Self::Xyz => "Xyz", Self::Yzx => "Yzx", Self::Zxy => "Zxy", Self::Xzy => "Xzy", Self::Yxz => "Yxz", Self::Zyx => "Zyx", Self::Sxyz => "Sxyz", Self::Sxyx => "Sxyx", Self::Sxzy => "Sxzy", Self::Sxzx => "Sxzx", Self::Syzx => "Syzx", Self::Syzy => "Syzy", Self::Syxz => "Syxz", Self::Syxy => "Syxy", Self::Szxy => "Szxy", Self::Szxz => "Szxz", Self::Szyx => "Szyx", Self::Szyz => "Szyz", Self::Rzyx => "Rzyx", Self::Rxyx => "Rxyx", Self::Ryzx => "Ryzx", Self::Rxzx => "Rxzx", Self::Rxzy => "Rxzy", Self::Ryzy => "Ryzy", Self::Rzxy => "Rzxy", Self::Ryxy => "Ryxy", Self::Ryxz => "Ryxz", Self::Rzxz => "Rzxz", Self::Rxyz => "Rxyz", Self::Rzyz => "Rzyz", _ => "Unknown", } ) } } #[doc(hidden)] impl IntoGlib for EulerOrder { type GlibType = ffi::graphene_euler_order_t; fn into_glib(self) -> ffi::graphene_euler_order_t { match self { Self::Default => ffi::GRAPHENE_EULER_ORDER_DEFAULT, Self::Xyz => ffi::GRAPHENE_EULER_ORDER_XYZ, Self::Yzx => ffi::GRAPHENE_EULER_ORDER_YZX, Self::Zxy => ffi::GRAPHENE_EULER_ORDER_ZXY, Self::Xzy => ffi::GRAPHENE_EULER_ORDER_XZY, Self::Yxz => ffi::GRAPHENE_EULER_ORDER_YXZ, Self::Zyx => ffi::GRAPHENE_EULER_ORDER_ZYX, Self::Sxyz => ffi::GRAPHENE_EULER_ORDER_SXYZ, Self::Sxyx => ffi::GRAPHENE_EULER_ORDER_SXYX, Self::Sxzy => ffi::GRAPHENE_EULER_ORDER_SXZY, Self::Sxzx => ffi::GRAPHENE_EULER_ORDER_SXZX, Self::Syzx => ffi::GRAPHENE_EULER_ORDER_SYZX, Self::Syzy => ffi::GRAPHENE_EULER_ORDER_SYZY, Self::Syxz => ffi::GRAPHENE_EULER_ORDER_SYXZ, Self::Syxy => ffi::GRAPHENE_EULER_ORDER_SYXY, Self::Szxy => ffi::GRAPHENE_EULER_ORDER_SZXY, Self::Szxz => ffi::GRAPHENE_EULER_ORDER_SZXZ, Self::Szyx => ffi::GRAPHENE_EULER_ORDER_SZYX, Self::Szyz => ffi::GRAPHENE_EULER_ORDER_SZYZ, Self::Rzyx => ffi::GRAPHENE_EULER_ORDER_RZYX, Self::Rxyx => ffi::GRAPHENE_EULER_ORDER_RXYX, Self::Ryzx => ffi::GRAPHENE_EULER_ORDER_RYZX, Self::Rxzx => ffi::GRAPHENE_EULER_ORDER_RXZX, Self::Rxzy => ffi::GRAPHENE_EULER_ORDER_RXZY, Self::Ryzy => ffi::GRAPHENE_EULER_ORDER_RYZY, Self::Rzxy => ffi::GRAPHENE_EULER_ORDER_RZXY, Self::Ryxy => ffi::GRAPHENE_EULER_ORDER_RYXY, Self::Ryxz => ffi::GRAPHENE_EULER_ORDER_RYXZ, Self::Rzxz => ffi::GRAPHENE_EULER_ORDER_RZXZ, Self::Rxyz => ffi::GRAPHENE_EULER_ORDER_RXYZ, Self::Rzyz => ffi::GRAPHENE_EULER_ORDER_RZYZ, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for EulerOrder { unsafe fn from_glib(value: ffi::graphene_euler_order_t) -> Self { skip_assert_initialized!(); match value { ffi::GRAPHENE_EULER_ORDER_DEFAULT => Self::Default, ffi::GRAPHENE_EULER_ORDER_XYZ => Self::Xyz, ffi::GRAPHENE_EULER_ORDER_YZX => Self::Yzx, ffi::GRAPHENE_EULER_ORDER_ZXY => Self::Zxy, ffi::GRAPHENE_EULER_ORDER_XZY => Self::Xzy, ffi::GRAPHENE_EULER_ORDER_YXZ => Self::Yxz, ffi::GRAPHENE_EULER_ORDER_ZYX => Self::Zyx, ffi::GRAPHENE_EULER_ORDER_SXYZ => Self::Sxyz, ffi::GRAPHENE_EULER_ORDER_SXYX => Self::Sxyx, ffi::GRAPHENE_EULER_ORDER_SXZY => Self::Sxzy, ffi::GRAPHENE_EULER_ORDER_SXZX => Self::Sxzx, ffi::GRAPHENE_EULER_ORDER_SYZX => Self::Syzx, ffi::GRAPHENE_EULER_ORDER_SYZY => Self::Syzy, ffi::GRAPHENE_EULER_ORDER_SYXZ => Self::Syxz, ffi::GRAPHENE_EULER_ORDER_SYXY => Self::Syxy, ffi::GRAPHENE_EULER_ORDER_SZXY => Self::Szxy, ffi::GRAPHENE_EULER_ORDER_SZXZ => Self::Szxz, ffi::GRAPHENE_EULER_ORDER_SZYX => Self::Szyx, ffi::GRAPHENE_EULER_ORDER_SZYZ => Self::Szyz, ffi::GRAPHENE_EULER_ORDER_RZYX => Self::Rzyx, ffi::GRAPHENE_EULER_ORDER_RXYX => Self::Rxyx, ffi::GRAPHENE_EULER_ORDER_RYZX => Self::Ryzx, ffi::GRAPHENE_EULER_ORDER_RXZX => Self::Rxzx, ffi::GRAPHENE_EULER_ORDER_RXZY => Self::Rxzy, ffi::GRAPHENE_EULER_ORDER_RYZY => Self::Ryzy, ffi::GRAPHENE_EULER_ORDER_RZXY => Self::Rzxy, ffi::GRAPHENE_EULER_ORDER_RYXY => Self::Ryxy, ffi::GRAPHENE_EULER_ORDER_RYXZ => Self::Ryxz, ffi::GRAPHENE_EULER_ORDER_RZXZ => Self::Rzxz, ffi::GRAPHENE_EULER_ORDER_RXYZ => Self::Rxyz, ffi::GRAPHENE_EULER_ORDER_RZYZ => Self::Rzyz, value => Self::__Unknown(value), } } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "graphene_ray_intersection_kind_t")] pub enum RayIntersectionKind { #[doc(alias = "GRAPHENE_RAY_INTERSECTION_KIND_NONE")] None, #[doc(alias = "GRAPHENE_RAY_INTERSECTION_KIND_ENTER")] Enter, #[doc(alias = "GRAPHENE_RAY_INTERSECTION_KIND_LEAVE")] Leave, #[doc(hidden)] __Unknown(i32), } impl fmt::Display for RayIntersectionKind { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "RayIntersectionKind::{}", match *self { Self::None => "None", Self::Enter => "Enter", Self::Leave => "Leave", _ => "Unknown", } ) } } #[doc(hidden)] impl IntoGlib for RayIntersectionKind { type GlibType = ffi::graphene_ray_intersection_kind_t; fn into_glib(self) -> ffi::graphene_ray_intersection_kind_t { match self { Self::None => ffi::GRAPHENE_RAY_INTERSECTION_KIND_NONE, Self::Enter => ffi::GRAPHENE_RAY_INTERSECTION_KIND_ENTER, Self::Leave => ffi::GRAPHENE_RAY_INTERSECTION_KIND_LEAVE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for RayIntersectionKind { unsafe fn from_glib(value: ffi::graphene_ray_intersection_kind_t) -> Self { skip_assert_initialized!(); match value { ffi::GRAPHENE_RAY_INTERSECTION_KIND_NONE => Self::None, ffi::GRAPHENE_RAY_INTERSECTION_KIND_ENTER => Self::Enter, ffi::GRAPHENE_RAY_INTERSECTION_KIND_LEAVE => Self::Leave, value => Self::__Unknown(value), } } } graphene-rs-0.14.8/src/auto/euler.rs000064400000000000000000000134170072674642500154100ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::EulerOrder; use crate::Matrix; use crate::Quaternion; use crate::Vec3; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Euler(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_euler_get_type(), ptr as *mut _) as *mut ffi::graphene_euler_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_euler_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_euler_get_type(), } } impl Euler { #[doc(alias = "graphene_euler_equal")] fn equal(&self, b: &Euler) -> bool { unsafe { ffi::graphene_euler_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_euler_get_alpha")] #[doc(alias = "get_alpha")] pub fn alpha(&self) -> f32 { unsafe { ffi::graphene_euler_get_alpha(self.to_glib_none().0) } } #[doc(alias = "graphene_euler_get_beta")] #[doc(alias = "get_beta")] pub fn beta(&self) -> f32 { unsafe { ffi::graphene_euler_get_beta(self.to_glib_none().0) } } #[doc(alias = "graphene_euler_get_gamma")] #[doc(alias = "get_gamma")] pub fn gamma(&self) -> f32 { unsafe { ffi::graphene_euler_get_gamma(self.to_glib_none().0) } } #[doc(alias = "graphene_euler_get_order")] #[doc(alias = "get_order")] pub fn order(&self) -> EulerOrder { unsafe { from_glib(ffi::graphene_euler_get_order(self.to_glib_none().0)) } } #[doc(alias = "graphene_euler_get_x")] #[doc(alias = "get_x")] pub fn x(&self) -> f32 { unsafe { ffi::graphene_euler_get_x(self.to_glib_none().0) } } #[doc(alias = "graphene_euler_get_y")] #[doc(alias = "get_y")] pub fn y(&self) -> f32 { unsafe { ffi::graphene_euler_get_y(self.to_glib_none().0) } } #[doc(alias = "graphene_euler_get_z")] #[doc(alias = "get_z")] pub fn z(&self) -> f32 { unsafe { ffi::graphene_euler_get_z(self.to_glib_none().0) } } #[doc(alias = "graphene_euler_init")] pub fn init(&mut self, x: f32, y: f32, z: f32) { unsafe { ffi::graphene_euler_init(self.to_glib_none_mut().0, x, y, z); } } #[doc(alias = "graphene_euler_init_from_euler")] pub fn init_from_euler(&mut self, src: Option<&Euler>) { unsafe { ffi::graphene_euler_init_from_euler(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_euler_init_from_matrix")] pub fn init_from_matrix(&mut self, m: Option<&Matrix>, order: EulerOrder) { unsafe { ffi::graphene_euler_init_from_matrix( self.to_glib_none_mut().0, m.to_glib_none().0, order.into_glib(), ); } } #[doc(alias = "graphene_euler_init_from_quaternion")] pub fn init_from_quaternion(&mut self, q: Option<&Quaternion>, order: EulerOrder) { unsafe { ffi::graphene_euler_init_from_quaternion( self.to_glib_none_mut().0, q.to_glib_none().0, order.into_glib(), ); } } #[doc(alias = "graphene_euler_init_from_radians")] pub fn init_from_radians( &mut self, x: f32, y: f32, z: f32, order: EulerOrder, ) -> Option { unsafe { from_glib_none(ffi::graphene_euler_init_from_radians( self.to_glib_none_mut().0, x, y, z, order.into_glib(), )) } } #[doc(alias = "graphene_euler_init_from_vec3")] pub fn init_from_vec3(&mut self, v: Option<&Vec3>, order: EulerOrder) { unsafe { ffi::graphene_euler_init_from_vec3( self.to_glib_none_mut().0, v.to_glib_none().0, order.into_glib(), ); } } #[doc(alias = "graphene_euler_init_with_order")] pub fn init_with_order(&mut self, x: f32, y: f32, z: f32, order: EulerOrder) { unsafe { ffi::graphene_euler_init_with_order( self.to_glib_none_mut().0, x, y, z, order.into_glib(), ); } } #[doc(alias = "graphene_euler_reorder")] pub fn reorder(&self, order: EulerOrder) -> Euler { unsafe { let mut res = Euler::uninitialized(); ffi::graphene_euler_reorder( self.to_glib_none().0, order.into_glib(), res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_euler_to_matrix")] pub fn to_matrix(&self) -> Matrix { unsafe { let mut res = Matrix::uninitialized(); ffi::graphene_euler_to_matrix(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_euler_to_quaternion")] pub fn to_quaternion(&self) -> Quaternion { unsafe { let mut res = Quaternion::uninitialized(); ffi::graphene_euler_to_quaternion(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_euler_to_vec3")] pub fn to_vec3(&self) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_euler_to_vec3(self.to_glib_none().0, res.to_glib_none_mut().0); res } } } impl PartialEq for Euler { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Euler {} graphene-rs-0.14.8/src/auto/frustum.rs000064400000000000000000000061530072674642500160000ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Box; use crate::Matrix; use crate::Plane; use crate::Point3D; use crate::Sphere; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Frustum(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_frustum_get_type(), ptr as *mut _) as *mut ffi::graphene_frustum_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_frustum_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_frustum_get_type(), } } impl Frustum { #[doc(alias = "graphene_frustum_contains_point")] pub fn contains_point(&self, point: &Point3D) -> bool { unsafe { ffi::graphene_frustum_contains_point(self.to_glib_none().0, point.to_glib_none().0) } } #[doc(alias = "graphene_frustum_equal")] fn equal(&self, b: &Frustum) -> bool { unsafe { ffi::graphene_frustum_equal(self.to_glib_none().0, b.to_glib_none().0) } } //#[doc(alias = "graphene_frustum_get_planes")] //#[doc(alias = "get_planes")] //pub fn planes(&self, planes: /*Unimplemented*/FixedArray TypeId { ns_id: 1, id: 8 }; 6) { // unsafe { TODO: call ffi:graphene_frustum_get_planes() } //} #[doc(alias = "graphene_frustum_init")] pub fn init(&mut self, p0: &Plane, p1: &Plane, p2: &Plane, p3: &Plane, p4: &Plane, p5: &Plane) { unsafe { ffi::graphene_frustum_init( self.to_glib_none_mut().0, p0.to_glib_none().0, p1.to_glib_none().0, p2.to_glib_none().0, p3.to_glib_none().0, p4.to_glib_none().0, p5.to_glib_none().0, ); } } #[doc(alias = "graphene_frustum_init_from_frustum")] pub fn init_from_frustum(&mut self, src: &Frustum) { unsafe { ffi::graphene_frustum_init_from_frustum( self.to_glib_none_mut().0, src.to_glib_none().0, ); } } #[doc(alias = "graphene_frustum_init_from_matrix")] pub fn init_from_matrix(&mut self, matrix: &Matrix) { unsafe { ffi::graphene_frustum_init_from_matrix( self.to_glib_none_mut().0, matrix.to_glib_none().0, ); } } #[doc(alias = "graphene_frustum_intersects_box")] pub fn intersects_box(&self, box_: &Box) -> bool { unsafe { ffi::graphene_frustum_intersects_box(self.to_glib_none().0, box_.to_glib_none().0) } } #[doc(alias = "graphene_frustum_intersects_sphere")] pub fn intersects_sphere(&self, sphere: &Sphere) -> bool { unsafe { ffi::graphene_frustum_intersects_sphere(self.to_glib_none().0, sphere.to_glib_none().0) } } } impl PartialEq for Frustum { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Frustum {} graphene-rs-0.14.8/src/auto/matrix.rs000064400000000000000000000520260072674642500155770ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Box; use crate::Euler; use crate::Point; use crate::Point3D; use crate::Quad; use crate::Quaternion; use crate::Ray; use crate::Rect; use crate::Sphere; use crate::Vec3; use crate::Vec4; use glib::translate::*; use std::mem; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Matrix(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_matrix_get_type(), ptr as *mut _) as *mut ffi::graphene_matrix_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_matrix_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_matrix_get_type(), } } impl Matrix { #[doc(alias = "graphene_matrix_decompose")] pub fn decompose(&self) -> Option<(Vec3, Vec3, Quaternion, Vec3, Vec4)> { unsafe { let mut translate = Vec3::uninitialized(); let mut scale = Vec3::uninitialized(); let mut rotate = Quaternion::uninitialized(); let mut shear = Vec3::uninitialized(); let mut perspective = Vec4::uninitialized(); let ret = ffi::graphene_matrix_decompose( self.to_glib_none().0, translate.to_glib_none_mut().0, scale.to_glib_none_mut().0, rotate.to_glib_none_mut().0, shear.to_glib_none_mut().0, perspective.to_glib_none_mut().0, ); if ret { Some((translate, scale, rotate, shear, perspective)) } else { None } } } #[doc(alias = "graphene_matrix_determinant")] pub fn determinant(&self) -> f32 { unsafe { ffi::graphene_matrix_determinant(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_equal")] fn equal(&self, b: &Matrix) -> bool { unsafe { ffi::graphene_matrix_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_matrix_equal_fast")] pub fn equal_fast(&self, b: &Matrix) -> bool { unsafe { ffi::graphene_matrix_equal_fast(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_matrix_get_row")] #[doc(alias = "get_row")] pub fn row(&self, index_: u32) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_matrix_get_row(self.to_glib_none().0, index_, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_matrix_get_value")] #[doc(alias = "get_value")] pub fn value(&self, row: u32, col: u32) -> f32 { unsafe { ffi::graphene_matrix_get_value(self.to_glib_none().0, row, col) } } #[doc(alias = "graphene_matrix_get_x_scale")] #[doc(alias = "get_x_scale")] pub fn x_scale(&self) -> f32 { unsafe { ffi::graphene_matrix_get_x_scale(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_get_x_translation")] #[doc(alias = "get_x_translation")] pub fn x_translation(&self) -> f32 { unsafe { ffi::graphene_matrix_get_x_translation(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_get_y_scale")] #[doc(alias = "get_y_scale")] pub fn y_scale(&self) -> f32 { unsafe { ffi::graphene_matrix_get_y_scale(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_get_y_translation")] #[doc(alias = "get_y_translation")] pub fn y_translation(&self) -> f32 { unsafe { ffi::graphene_matrix_get_y_translation(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_get_z_scale")] #[doc(alias = "get_z_scale")] pub fn z_scale(&self) -> f32 { unsafe { ffi::graphene_matrix_get_z_scale(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_get_z_translation")] #[doc(alias = "get_z_translation")] pub fn z_translation(&self) -> f32 { unsafe { ffi::graphene_matrix_get_z_translation(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_init_from_2d")] pub fn init_from_2d(&mut self, xx: f64, yx: f64, xy: f64, yy: f64, x_0: f64, y_0: f64) { unsafe { ffi::graphene_matrix_init_from_2d(self.to_glib_none_mut().0, xx, yx, xy, yy, x_0, y_0); } } //#[doc(alias = "graphene_matrix_init_from_float")] //pub fn init_from_float(&mut self, v: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 16) { // unsafe { TODO: call ffi:graphene_matrix_init_from_float() } //} #[doc(alias = "graphene_matrix_init_from_matrix")] pub fn init_from_matrix(&mut self, src: &Matrix) { unsafe { ffi::graphene_matrix_init_from_matrix(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_matrix_init_from_vec4")] pub fn init_from_vec4(&mut self, v0: &Vec4, v1: &Vec4, v2: &Vec4, v3: &Vec4) { unsafe { ffi::graphene_matrix_init_from_vec4( self.to_glib_none_mut().0, v0.to_glib_none().0, v1.to_glib_none().0, v2.to_glib_none().0, v3.to_glib_none().0, ); } } #[doc(alias = "graphene_matrix_init_frustum")] pub fn init_frustum( &mut self, left: f32, right: f32, bottom: f32, top: f32, z_near: f32, z_far: f32, ) { unsafe { ffi::graphene_matrix_init_frustum( self.to_glib_none_mut().0, left, right, bottom, top, z_near, z_far, ); } } #[doc(alias = "graphene_matrix_init_identity")] pub fn init_identity(&mut self) { unsafe { ffi::graphene_matrix_init_identity(self.to_glib_none_mut().0); } } #[doc(alias = "graphene_matrix_init_look_at")] pub fn init_look_at(&mut self, eye: &Vec3, center: &Vec3, up: &Vec3) { unsafe { ffi::graphene_matrix_init_look_at( self.to_glib_none_mut().0, eye.to_glib_none().0, center.to_glib_none().0, up.to_glib_none().0, ); } } #[doc(alias = "graphene_matrix_init_ortho")] pub fn init_ortho( &mut self, left: f32, right: f32, top: f32, bottom: f32, z_near: f32, z_far: f32, ) { unsafe { ffi::graphene_matrix_init_ortho( self.to_glib_none_mut().0, left, right, top, bottom, z_near, z_far, ); } } #[doc(alias = "graphene_matrix_init_perspective")] pub fn init_perspective(&mut self, fovy: f32, aspect: f32, z_near: f32, z_far: f32) { unsafe { ffi::graphene_matrix_init_perspective( self.to_glib_none_mut().0, fovy, aspect, z_near, z_far, ); } } #[doc(alias = "graphene_matrix_init_rotate")] pub fn init_rotate(&mut self, angle: f32, axis: &Vec3) { unsafe { ffi::graphene_matrix_init_rotate( self.to_glib_none_mut().0, angle, axis.to_glib_none().0, ); } } #[doc(alias = "graphene_matrix_init_scale")] pub fn init_scale(&mut self, x: f32, y: f32, z: f32) { unsafe { ffi::graphene_matrix_init_scale(self.to_glib_none_mut().0, x, y, z); } } #[doc(alias = "graphene_matrix_init_skew")] pub fn init_skew(&mut self, x_skew: f32, y_skew: f32) { unsafe { ffi::graphene_matrix_init_skew(self.to_glib_none_mut().0, x_skew, y_skew); } } #[doc(alias = "graphene_matrix_init_translate")] pub fn init_translate(&mut self, p: &Point3D) { unsafe { ffi::graphene_matrix_init_translate(self.to_glib_none_mut().0, p.to_glib_none().0); } } #[doc(alias = "graphene_matrix_interpolate")] pub fn interpolate(&self, b: &Matrix, factor: f64) -> Matrix { unsafe { let mut res = Matrix::uninitialized(); ffi::graphene_matrix_interpolate( self.to_glib_none().0, b.to_glib_none().0, factor, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_inverse")] pub fn inverse(&self) -> Option { unsafe { let mut res = Matrix::uninitialized(); let ret = ffi::graphene_matrix_inverse(self.to_glib_none().0, res.to_glib_none_mut().0); if ret { Some(res) } else { None } } } #[doc(alias = "graphene_matrix_is_2d")] pub fn is_2d(&self) -> bool { unsafe { ffi::graphene_matrix_is_2d(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_is_backface_visible")] pub fn is_backface_visible(&self) -> bool { unsafe { ffi::graphene_matrix_is_backface_visible(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_is_identity")] pub fn is_identity(&self) -> bool { unsafe { ffi::graphene_matrix_is_identity(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_is_singular")] pub fn is_singular(&self) -> bool { unsafe { ffi::graphene_matrix_is_singular(self.to_glib_none().0) } } #[doc(alias = "graphene_matrix_multiply")] pub fn multiply(&self, b: &Matrix) -> Matrix { unsafe { let mut res = Matrix::uninitialized(); ffi::graphene_matrix_multiply( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_near")] pub fn near(&self, b: &Matrix, epsilon: f32) -> bool { unsafe { ffi::graphene_matrix_near(self.to_glib_none().0, b.to_glib_none().0, epsilon) } } #[doc(alias = "graphene_matrix_normalize")] pub fn normalize(&self) -> Matrix { unsafe { let mut res = Matrix::uninitialized(); ffi::graphene_matrix_normalize(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_matrix_perspective")] pub fn perspective(&self, depth: f32) -> Matrix { unsafe { let mut res = Matrix::uninitialized(); ffi::graphene_matrix_perspective( self.to_glib_none().0, depth, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_print")] pub fn print(&self) { unsafe { ffi::graphene_matrix_print(self.to_glib_none().0); } } #[doc(alias = "graphene_matrix_project_point")] pub fn project_point(&self, p: &Point) -> Point { unsafe { let mut res = Point::uninitialized(); ffi::graphene_matrix_project_point( self.to_glib_none().0, p.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_project_rect")] pub fn project_rect(&self, r: &Rect) -> Quad { unsafe { let mut res = Quad::uninitialized(); ffi::graphene_matrix_project_rect( self.to_glib_none().0, r.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_project_rect_bounds")] pub fn project_rect_bounds(&self, r: &Rect) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_matrix_project_rect_bounds( self.to_glib_none().0, r.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_rotate")] pub fn rotate(&mut self, angle: f32, axis: &Vec3) { unsafe { ffi::graphene_matrix_rotate(self.to_glib_none_mut().0, angle, axis.to_glib_none().0); } } #[doc(alias = "graphene_matrix_rotate_euler")] pub fn rotate_euler(&mut self, e: &Euler) { unsafe { ffi::graphene_matrix_rotate_euler(self.to_glib_none_mut().0, e.to_glib_none().0); } } #[doc(alias = "graphene_matrix_rotate_quaternion")] pub fn rotate_quaternion(&mut self, q: &Quaternion) { unsafe { ffi::graphene_matrix_rotate_quaternion(self.to_glib_none_mut().0, q.to_glib_none().0); } } #[doc(alias = "graphene_matrix_rotate_x")] pub fn rotate_x(&mut self, angle: f32) { unsafe { ffi::graphene_matrix_rotate_x(self.to_glib_none_mut().0, angle); } } #[doc(alias = "graphene_matrix_rotate_y")] pub fn rotate_y(&mut self, angle: f32) { unsafe { ffi::graphene_matrix_rotate_y(self.to_glib_none_mut().0, angle); } } #[doc(alias = "graphene_matrix_rotate_z")] pub fn rotate_z(&mut self, angle: f32) { unsafe { ffi::graphene_matrix_rotate_z(self.to_glib_none_mut().0, angle); } } #[doc(alias = "graphene_matrix_scale")] pub fn scale(&mut self, factor_x: f32, factor_y: f32, factor_z: f32) { unsafe { ffi::graphene_matrix_scale(self.to_glib_none_mut().0, factor_x, factor_y, factor_z); } } #[doc(alias = "graphene_matrix_skew_xy")] pub fn skew_xy(&mut self, factor: f32) { unsafe { ffi::graphene_matrix_skew_xy(self.to_glib_none_mut().0, factor); } } #[doc(alias = "graphene_matrix_skew_xz")] pub fn skew_xz(&mut self, factor: f32) { unsafe { ffi::graphene_matrix_skew_xz(self.to_glib_none_mut().0, factor); } } #[doc(alias = "graphene_matrix_skew_yz")] pub fn skew_yz(&mut self, factor: f32) { unsafe { ffi::graphene_matrix_skew_yz(self.to_glib_none_mut().0, factor); } } #[doc(alias = "graphene_matrix_to_2d")] pub fn to_2d(&self) -> Option<(f64, f64, f64, f64, f64, f64)> { unsafe { let mut xx = mem::MaybeUninit::uninit(); let mut yx = mem::MaybeUninit::uninit(); let mut xy = mem::MaybeUninit::uninit(); let mut yy = mem::MaybeUninit::uninit(); let mut x_0 = mem::MaybeUninit::uninit(); let mut y_0 = mem::MaybeUninit::uninit(); let ret = ffi::graphene_matrix_to_2d( self.to_glib_none().0, xx.as_mut_ptr(), yx.as_mut_ptr(), xy.as_mut_ptr(), yy.as_mut_ptr(), x_0.as_mut_ptr(), y_0.as_mut_ptr(), ); let xx = xx.assume_init(); let yx = yx.assume_init(); let xy = xy.assume_init(); let yy = yy.assume_init(); let x_0 = x_0.assume_init(); let y_0 = y_0.assume_init(); if ret { Some((xx, yx, xy, yy, x_0, y_0)) } else { None } } } //#[doc(alias = "graphene_matrix_to_float")] //pub fn to_float(&self, v: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 16) { // unsafe { TODO: call ffi:graphene_matrix_to_float() } //} #[doc(alias = "graphene_matrix_transform_bounds")] pub fn transform_bounds(&self, r: &Rect) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_matrix_transform_bounds( self.to_glib_none().0, r.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_transform_box")] pub fn transform_box(&self, b: &Box) -> Box { unsafe { let mut res = Box::uninitialized(); ffi::graphene_matrix_transform_box( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_transform_point")] pub fn transform_point(&self, p: &Point) -> Point { unsafe { let mut res = Point::uninitialized(); ffi::graphene_matrix_transform_point( self.to_glib_none().0, p.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_transform_point3d")] pub fn transform_point3d(&self, p: &Point3D) -> Point3D { unsafe { let mut res = Point3D::uninitialized(); ffi::graphene_matrix_transform_point3d( self.to_glib_none().0, p.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_transform_ray")] pub fn transform_ray(&self, r: &Ray) -> Ray { unsafe { let mut res = Ray::uninitialized(); ffi::graphene_matrix_transform_ray( self.to_glib_none().0, r.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_transform_rect")] pub fn transform_rect(&self, r: &Rect) -> Quad { unsafe { let mut res = Quad::uninitialized(); ffi::graphene_matrix_transform_rect( self.to_glib_none().0, r.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_transform_sphere")] pub fn transform_sphere(&self, s: &Sphere) -> Sphere { unsafe { let mut res = Sphere::uninitialized(); ffi::graphene_matrix_transform_sphere( self.to_glib_none().0, s.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_transform_vec3")] pub fn transform_vec3(&self, v: &Vec3) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_matrix_transform_vec3( self.to_glib_none().0, v.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_transform_vec4")] pub fn transform_vec4(&self, v: &Vec4) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_matrix_transform_vec4( self.to_glib_none().0, v.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_translate")] pub fn translate(&mut self, pos: &Point3D) { unsafe { ffi::graphene_matrix_translate(self.to_glib_none_mut().0, pos.to_glib_none().0); } } #[doc(alias = "graphene_matrix_transpose")] pub fn transpose(&self) -> Matrix { unsafe { let mut res = Matrix::uninitialized(); ffi::graphene_matrix_transpose(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_matrix_unproject_point3d")] pub fn unproject_point3d(&self, modelview: &Matrix, point: &Point3D) -> Point3D { unsafe { let mut res = Point3D::uninitialized(); ffi::graphene_matrix_unproject_point3d( self.to_glib_none().0, modelview.to_glib_none().0, point.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_untransform_bounds")] pub fn untransform_bounds(&self, r: &Rect, bounds: &Rect) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_matrix_untransform_bounds( self.to_glib_none().0, r.to_glib_none().0, bounds.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_matrix_untransform_point")] pub fn untransform_point(&self, p: &Point, bounds: &Rect) -> Option { unsafe { let mut res = Point::uninitialized(); let ret = ffi::graphene_matrix_untransform_point( self.to_glib_none().0, p.to_glib_none().0, bounds.to_glib_none().0, res.to_glib_none_mut().0, ); if ret { Some(res) } else { None } } } } impl PartialEq for Matrix { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Matrix {} graphene-rs-0.14.8/src/auto/mod.rs000064400000000000000000000016720072674642500150530ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT mod box_; pub use self::box_::Box; mod euler; pub use self::euler::Euler; mod frustum; pub use self::frustum::Frustum; mod matrix; pub use self::matrix::Matrix; mod plane; pub use self::plane::Plane; mod point; pub use self::point::Point; mod point3_d; pub use self::point3_d::Point3D; mod quad; pub use self::quad::Quad; mod quaternion; pub use self::quaternion::Quaternion; mod ray; pub use self::ray::Ray; mod rect; pub use self::rect::Rect; mod size; pub use self::size::Size; mod sphere; pub use self::sphere::Sphere; mod triangle; pub use self::triangle::Triangle; mod vec2; pub use self::vec2::Vec2; mod vec3; pub use self::vec3::Vec3; mod vec4; pub use self::vec4::Vec4; mod enums; pub use self::enums::EulerOrder; pub use self::enums::RayIntersectionKind; #[doc(hidden)] pub mod traits {} graphene-rs-0.14.8/src/auto/plane.rs000064400000000000000000000102000072674642500153560ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Matrix; use crate::Point3D; use crate::Vec3; use crate::Vec4; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Plane(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_plane_get_type(), ptr as *mut _) as *mut ffi::graphene_plane_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_plane_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_plane_get_type(), } } impl Plane { #[doc(alias = "graphene_plane_distance")] pub fn distance(&self, point: &Point3D) -> f32 { unsafe { ffi::graphene_plane_distance(self.to_glib_none().0, point.to_glib_none().0) } } #[doc(alias = "graphene_plane_equal")] fn equal(&self, b: &Plane) -> bool { unsafe { ffi::graphene_plane_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_plane_get_constant")] #[doc(alias = "get_constant")] pub fn constant(&self) -> f32 { unsafe { ffi::graphene_plane_get_constant(self.to_glib_none().0) } } #[doc(alias = "graphene_plane_get_normal")] #[doc(alias = "get_normal")] pub fn normal(&self) -> Vec3 { unsafe { let mut normal = Vec3::uninitialized(); ffi::graphene_plane_get_normal(self.to_glib_none().0, normal.to_glib_none_mut().0); normal } } #[doc(alias = "graphene_plane_init")] pub fn init(&mut self, normal: Option<&Vec3>, constant: f32) { unsafe { ffi::graphene_plane_init(self.to_glib_none_mut().0, normal.to_glib_none().0, constant); } } #[doc(alias = "graphene_plane_init_from_plane")] pub fn init_from_plane(&mut self, src: &Plane) { unsafe { ffi::graphene_plane_init_from_plane(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_plane_init_from_point")] pub fn init_from_point(&mut self, normal: &Vec3, point: &Point3D) { unsafe { ffi::graphene_plane_init_from_point( self.to_glib_none_mut().0, normal.to_glib_none().0, point.to_glib_none().0, ); } } #[doc(alias = "graphene_plane_init_from_points")] pub fn init_from_points(&mut self, a: &Point3D, b: &Point3D, c: &Point3D) { unsafe { ffi::graphene_plane_init_from_points( self.to_glib_none_mut().0, a.to_glib_none().0, b.to_glib_none().0, c.to_glib_none().0, ); } } #[doc(alias = "graphene_plane_init_from_vec4")] pub fn init_from_vec4(&mut self, src: &Vec4) { unsafe { ffi::graphene_plane_init_from_vec4(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_plane_negate")] pub fn negate(&self) -> Plane { unsafe { let mut res = Plane::uninitialized(); ffi::graphene_plane_negate(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_plane_normalize")] pub fn normalize(&self) -> Plane { unsafe { let mut res = Plane::uninitialized(); ffi::graphene_plane_normalize(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_plane_transform")] pub fn transform(&self, matrix: &Matrix, normal_matrix: Option<&Matrix>) -> Plane { unsafe { let mut res = Plane::uninitialized(); ffi::graphene_plane_transform( self.to_glib_none().0, matrix.to_glib_none().0, normal_matrix.to_glib_none().0, res.to_glib_none_mut().0, ); res } } } impl PartialEq for Plane { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Plane {} graphene-rs-0.14.8/src/auto/point.rs000064400000000000000000000063450072674642500154270ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Vec2; use glib::translate::*; use std::mem; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Point(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_point_get_type(), ptr as *mut _) as *mut ffi::graphene_point_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_point_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_point_get_type(), } } impl Point { #[doc(alias = "graphene_point_distance")] pub fn distance(&self, b: &Point) -> (f32, f32, f32) { unsafe { let mut d_x = mem::MaybeUninit::uninit(); let mut d_y = mem::MaybeUninit::uninit(); let ret = ffi::graphene_point_distance( self.to_glib_none().0, b.to_glib_none().0, d_x.as_mut_ptr(), d_y.as_mut_ptr(), ); let d_x = d_x.assume_init(); let d_y = d_y.assume_init(); (ret, d_x, d_y) } } #[doc(alias = "graphene_point_equal")] fn equal(&self, b: &Point) -> bool { unsafe { ffi::graphene_point_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_point_init")] pub fn init(&mut self, x: f32, y: f32) { unsafe { ffi::graphene_point_init(self.to_glib_none_mut().0, x, y); } } #[doc(alias = "graphene_point_init_from_point")] pub fn init_from_point(&mut self, src: &Point) { unsafe { ffi::graphene_point_init_from_point(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_point_init_from_vec2")] pub fn init_from_vec2(&mut self, src: &Vec2) { unsafe { ffi::graphene_point_init_from_vec2(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_point_interpolate")] pub fn interpolate(&self, b: &Point, factor: f64) -> Point { unsafe { let mut res = Point::uninitialized(); ffi::graphene_point_interpolate( self.to_glib_none().0, b.to_glib_none().0, factor, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_point_near")] pub fn near(&self, b: &Point, epsilon: f32) -> bool { unsafe { ffi::graphene_point_near(self.to_glib_none().0, b.to_glib_none().0, epsilon) } } #[doc(alias = "graphene_point_to_vec2")] pub fn to_vec2(&self) -> Vec2 { unsafe { let mut v = Vec2::uninitialized(); ffi::graphene_point_to_vec2(self.to_glib_none().0, v.to_glib_none_mut().0); v } } #[doc(alias = "graphene_point_zero")] pub fn zero() -> Point { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_point_zero()) } } } impl PartialEq for Point { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Point {} graphene-rs-0.14.8/src/auto/point3_d.rs000064400000000000000000000116020072674642500160050ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Rect; use crate::Vec3; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Point3D(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_point3d_get_type(), ptr as *mut _) as *mut ffi::graphene_point3d_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_point3d_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_point3d_get_type(), } } impl Point3D { #[doc(alias = "graphene_point3d_cross")] pub fn cross(&self, b: &Point3D) -> Point3D { unsafe { let mut res = Point3D::uninitialized(); ffi::graphene_point3d_cross( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_point3d_distance")] pub fn distance(&self, b: &Point3D) -> (f32, Vec3) { unsafe { let mut delta = Vec3::uninitialized(); let ret = ffi::graphene_point3d_distance( self.to_glib_none().0, b.to_glib_none().0, delta.to_glib_none_mut().0, ); (ret, delta) } } #[doc(alias = "graphene_point3d_dot")] pub fn dot(&self, b: &Point3D) -> f32 { unsafe { ffi::graphene_point3d_dot(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_point3d_equal")] fn equal(&self, b: &Point3D) -> bool { unsafe { ffi::graphene_point3d_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_point3d_init")] pub fn init(&mut self, x: f32, y: f32, z: f32) { unsafe { ffi::graphene_point3d_init(self.to_glib_none_mut().0, x, y, z); } } #[doc(alias = "graphene_point3d_init_from_point")] pub fn init_from_point(&mut self, src: &Point3D) { unsafe { ffi::graphene_point3d_init_from_point(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_point3d_init_from_vec3")] pub fn init_from_vec3(&mut self, v: &Vec3) { unsafe { ffi::graphene_point3d_init_from_vec3(self.to_glib_none_mut().0, v.to_glib_none().0); } } #[doc(alias = "graphene_point3d_interpolate")] pub fn interpolate(&self, b: &Point3D, factor: f64) -> Point3D { unsafe { let mut res = Point3D::uninitialized(); ffi::graphene_point3d_interpolate( self.to_glib_none().0, b.to_glib_none().0, factor, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_point3d_length")] pub fn length(&self) -> f32 { unsafe { ffi::graphene_point3d_length(self.to_glib_none().0) } } #[doc(alias = "graphene_point3d_near")] pub fn near(&self, b: &Point3D, epsilon: f32) -> bool { unsafe { ffi::graphene_point3d_near(self.to_glib_none().0, b.to_glib_none().0, epsilon) } } #[doc(alias = "graphene_point3d_normalize")] pub fn normalize(&self) -> Point3D { unsafe { let mut res = Point3D::uninitialized(); ffi::graphene_point3d_normalize(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_point3d_normalize_viewport")] pub fn normalize_viewport(&self, viewport: &Rect, z_near: f32, z_far: f32) -> Point3D { unsafe { let mut res = Point3D::uninitialized(); ffi::graphene_point3d_normalize_viewport( self.to_glib_none().0, viewport.to_glib_none().0, z_near, z_far, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_point3d_scale")] pub fn scale(&self, factor: f32) -> Point3D { unsafe { let mut res = Point3D::uninitialized(); ffi::graphene_point3d_scale(self.to_glib_none().0, factor, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_point3d_to_vec3")] pub fn to_vec3(&self) -> Vec3 { unsafe { let mut v = Vec3::uninitialized(); ffi::graphene_point3d_to_vec3(self.to_glib_none().0, v.to_glib_none_mut().0); v } } #[doc(alias = "graphene_point3d_zero")] pub fn zero() -> Point3D { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_point3d_zero()) } } } impl PartialEq for Point3D { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Point3D {} graphene-rs-0.14.8/src/auto/quad.rs000064400000000000000000000043130072674642500152210ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Point; use crate::Rect; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Quad(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_quad_get_type(), ptr as *mut _) as *mut ffi::graphene_quad_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_quad_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_quad_get_type(), } } impl Quad { #[doc(alias = "graphene_quad_bounds")] pub fn bounds(&self) -> Rect { unsafe { let mut r = Rect::uninitialized(); ffi::graphene_quad_bounds(self.to_glib_none().0, r.to_glib_none_mut().0); r } } #[doc(alias = "graphene_quad_contains")] pub fn contains(&self, p: &Point) -> bool { unsafe { ffi::graphene_quad_contains(self.to_glib_none().0, p.to_glib_none().0) } } #[doc(alias = "graphene_quad_get_point")] #[doc(alias = "get_point")] pub fn point(&self, index_: u32) -> Option { unsafe { from_glib_none(ffi::graphene_quad_get_point(self.to_glib_none().0, index_)) } } #[doc(alias = "graphene_quad_init")] pub fn init(&mut self, p1: &Point, p2: &Point, p3: &Point, p4: &Point) { unsafe { ffi::graphene_quad_init( self.to_glib_none_mut().0, p1.to_glib_none().0, p2.to_glib_none().0, p3.to_glib_none().0, p4.to_glib_none().0, ); } } //#[doc(alias = "graphene_quad_init_from_points")] //pub fn init_from_points(&mut self, points: /*Unimplemented*/FixedArray TypeId { ns_id: 1, id: 12 }; 4) { // unsafe { TODO: call ffi:graphene_quad_init_from_points() } //} #[doc(alias = "graphene_quad_init_from_rect")] pub fn init_from_rect(&mut self, r: &Rect) { unsafe { ffi::graphene_quad_init_from_rect(self.to_glib_none_mut().0, r.to_glib_none().0); } } } graphene-rs-0.14.8/src/auto/quaternion.rs000064400000000000000000000204140072674642500164540ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Euler; use crate::Matrix; use crate::Vec3; use crate::Vec4; use glib::translate::*; use std::mem; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Quaternion(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_quaternion_get_type(), ptr as *mut _) as *mut ffi::graphene_quaternion_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_quaternion_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_quaternion_get_type(), } } impl Quaternion { #[doc(alias = "graphene_quaternion_add")] pub fn add(&self, b: &Quaternion) -> Quaternion { unsafe { let mut res = Quaternion::uninitialized(); ffi::graphene_quaternion_add( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_quaternion_dot")] pub fn dot(&self, b: &Quaternion) -> f32 { unsafe { ffi::graphene_quaternion_dot(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_quaternion_equal")] fn equal(&self, b: &Quaternion) -> bool { unsafe { ffi::graphene_quaternion_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_quaternion_init")] pub fn init(&mut self, x: f32, y: f32, z: f32, w: f32) { unsafe { ffi::graphene_quaternion_init(self.to_glib_none_mut().0, x, y, z, w); } } #[doc(alias = "graphene_quaternion_init_from_angle_vec3")] pub fn init_from_angle_vec3(&mut self, angle: f32, axis: &Vec3) { unsafe { ffi::graphene_quaternion_init_from_angle_vec3( self.to_glib_none_mut().0, angle, axis.to_glib_none().0, ); } } #[doc(alias = "graphene_quaternion_init_from_angles")] pub fn init_from_angles(&mut self, deg_x: f32, deg_y: f32, deg_z: f32) { unsafe { ffi::graphene_quaternion_init_from_angles( self.to_glib_none_mut().0, deg_x, deg_y, deg_z, ); } } #[doc(alias = "graphene_quaternion_init_from_euler")] pub fn init_from_euler(&mut self, e: &Euler) { unsafe { ffi::graphene_quaternion_init_from_euler(self.to_glib_none_mut().0, e.to_glib_none().0); } } #[doc(alias = "graphene_quaternion_init_from_matrix")] pub fn init_from_matrix(&mut self, m: &Matrix) { unsafe { ffi::graphene_quaternion_init_from_matrix( self.to_glib_none_mut().0, m.to_glib_none().0, ); } } #[doc(alias = "graphene_quaternion_init_from_quaternion")] pub fn init_from_quaternion(&mut self, src: &Quaternion) { unsafe { ffi::graphene_quaternion_init_from_quaternion( self.to_glib_none_mut().0, src.to_glib_none().0, ); } } #[doc(alias = "graphene_quaternion_init_from_radians")] pub fn init_from_radians(&mut self, rad_x: f32, rad_y: f32, rad_z: f32) { unsafe { ffi::graphene_quaternion_init_from_radians( self.to_glib_none_mut().0, rad_x, rad_y, rad_z, ); } } #[doc(alias = "graphene_quaternion_init_from_vec4")] pub fn init_from_vec4(&mut self, src: &Vec4) { unsafe { ffi::graphene_quaternion_init_from_vec4( self.to_glib_none_mut().0, src.to_glib_none().0, ); } } #[doc(alias = "graphene_quaternion_init_identity")] pub fn init_identity(&mut self) { unsafe { ffi::graphene_quaternion_init_identity(self.to_glib_none_mut().0); } } #[doc(alias = "graphene_quaternion_invert")] pub fn invert(&self) -> Quaternion { unsafe { let mut res = Quaternion::uninitialized(); ffi::graphene_quaternion_invert(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_quaternion_multiply")] pub fn multiply(&self, b: &Quaternion) -> Quaternion { unsafe { let mut res = Quaternion::uninitialized(); ffi::graphene_quaternion_multiply( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_quaternion_normalize")] pub fn normalize(&self) -> Quaternion { unsafe { let mut res = Quaternion::uninitialized(); ffi::graphene_quaternion_normalize(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_quaternion_scale")] pub fn scale(&self, factor: f32) -> Quaternion { unsafe { let mut res = Quaternion::uninitialized(); ffi::graphene_quaternion_scale(self.to_glib_none().0, factor, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_quaternion_slerp")] pub fn slerp(&self, b: &Quaternion, factor: f32) -> Quaternion { unsafe { let mut res = Quaternion::uninitialized(); ffi::graphene_quaternion_slerp( self.to_glib_none().0, b.to_glib_none().0, factor, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_quaternion_to_angle_vec3")] pub fn to_angle_vec3(&self) -> (f32, Vec3) { unsafe { let mut angle = mem::MaybeUninit::uninit(); let mut axis = Vec3::uninitialized(); ffi::graphene_quaternion_to_angle_vec3( self.to_glib_none().0, angle.as_mut_ptr(), axis.to_glib_none_mut().0, ); let angle = angle.assume_init(); (angle, axis) } } #[doc(alias = "graphene_quaternion_to_angles")] pub fn to_angles(&self) -> (f32, f32, f32) { unsafe { let mut deg_x = mem::MaybeUninit::uninit(); let mut deg_y = mem::MaybeUninit::uninit(); let mut deg_z = mem::MaybeUninit::uninit(); ffi::graphene_quaternion_to_angles( self.to_glib_none().0, deg_x.as_mut_ptr(), deg_y.as_mut_ptr(), deg_z.as_mut_ptr(), ); let deg_x = deg_x.assume_init(); let deg_y = deg_y.assume_init(); let deg_z = deg_z.assume_init(); (deg_x, deg_y, deg_z) } } #[doc(alias = "graphene_quaternion_to_matrix")] pub fn to_matrix(&self) -> Matrix { unsafe { let mut m = Matrix::uninitialized(); ffi::graphene_quaternion_to_matrix(self.to_glib_none().0, m.to_glib_none_mut().0); m } } #[doc(alias = "graphene_quaternion_to_radians")] pub fn to_radians(&self) -> (f32, f32, f32) { unsafe { let mut rad_x = mem::MaybeUninit::uninit(); let mut rad_y = mem::MaybeUninit::uninit(); let mut rad_z = mem::MaybeUninit::uninit(); ffi::graphene_quaternion_to_radians( self.to_glib_none().0, rad_x.as_mut_ptr(), rad_y.as_mut_ptr(), rad_z.as_mut_ptr(), ); let rad_x = rad_x.assume_init(); let rad_y = rad_y.assume_init(); let rad_z = rad_z.assume_init(); (rad_x, rad_y, rad_z) } } #[doc(alias = "graphene_quaternion_to_vec4")] pub fn to_vec4(&self) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_quaternion_to_vec4(self.to_glib_none().0, res.to_glib_none_mut().0); res } } } impl PartialEq for Quaternion { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Quaternion {} graphene-rs-0.14.8/src/auto/ray.rs000064400000000000000000000141420072674642500150630ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Box; use crate::Plane; use crate::Point3D; use crate::RayIntersectionKind; use crate::Sphere; use crate::Triangle; use crate::Vec3; use glib::translate::*; use std::mem; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Ray(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_ray_get_type(), ptr as *mut _) as *mut ffi::graphene_ray_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_ray_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_ray_get_type(), } } impl Ray { #[doc(alias = "graphene_ray_equal")] fn equal(&self, b: &Ray) -> bool { unsafe { ffi::graphene_ray_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_ray_get_closest_point_to_point")] #[doc(alias = "get_closest_point_to_point")] pub fn closest_point_to_point(&self, p: &Point3D) -> Point3D { unsafe { let mut res = Point3D::uninitialized(); ffi::graphene_ray_get_closest_point_to_point( self.to_glib_none().0, p.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_ray_get_direction")] #[doc(alias = "get_direction")] pub fn direction(&self) -> Vec3 { unsafe { let mut direction = Vec3::uninitialized(); ffi::graphene_ray_get_direction(self.to_glib_none().0, direction.to_glib_none_mut().0); direction } } #[doc(alias = "graphene_ray_get_distance_to_plane")] #[doc(alias = "get_distance_to_plane")] pub fn distance_to_plane(&self, p: &Plane) -> f32 { unsafe { ffi::graphene_ray_get_distance_to_plane(self.to_glib_none().0, p.to_glib_none().0) } } #[doc(alias = "graphene_ray_get_distance_to_point")] #[doc(alias = "get_distance_to_point")] pub fn distance_to_point(&self, p: &Point3D) -> f32 { unsafe { ffi::graphene_ray_get_distance_to_point(self.to_glib_none().0, p.to_glib_none().0) } } #[doc(alias = "graphene_ray_get_origin")] #[doc(alias = "get_origin")] pub fn origin(&self) -> Point3D { unsafe { let mut origin = Point3D::uninitialized(); ffi::graphene_ray_get_origin(self.to_glib_none().0, origin.to_glib_none_mut().0); origin } } #[doc(alias = "graphene_ray_get_position_at")] #[doc(alias = "get_position_at")] pub fn position_at(&self, t: f32) -> Point3D { unsafe { let mut position = Point3D::uninitialized(); ffi::graphene_ray_get_position_at( self.to_glib_none().0, t, position.to_glib_none_mut().0, ); position } } #[doc(alias = "graphene_ray_init")] pub fn init(&mut self, origin: Option<&Point3D>, direction: Option<&Vec3>) { unsafe { ffi::graphene_ray_init( self.to_glib_none_mut().0, origin.to_glib_none().0, direction.to_glib_none().0, ); } } #[doc(alias = "graphene_ray_init_from_ray")] pub fn init_from_ray(&mut self, src: &Ray) { unsafe { ffi::graphene_ray_init_from_ray(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_ray_init_from_vec3")] pub fn init_from_vec3(&mut self, origin: Option<&Vec3>, direction: Option<&Vec3>) { unsafe { ffi::graphene_ray_init_from_vec3( self.to_glib_none_mut().0, origin.to_glib_none().0, direction.to_glib_none().0, ); } } #[doc(alias = "graphene_ray_intersect_box")] pub fn intersect_box(&self, b: &Box) -> (RayIntersectionKind, f32) { unsafe { let mut t_out = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::graphene_ray_intersect_box( self.to_glib_none().0, b.to_glib_none().0, t_out.as_mut_ptr(), )); let t_out = t_out.assume_init(); (ret, t_out) } } #[doc(alias = "graphene_ray_intersect_sphere")] pub fn intersect_sphere(&self, s: &Sphere) -> (RayIntersectionKind, f32) { unsafe { let mut t_out = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::graphene_ray_intersect_sphere( self.to_glib_none().0, s.to_glib_none().0, t_out.as_mut_ptr(), )); let t_out = t_out.assume_init(); (ret, t_out) } } #[doc(alias = "graphene_ray_intersect_triangle")] pub fn intersect_triangle(&self, t: &Triangle) -> (RayIntersectionKind, f32) { unsafe { let mut t_out = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::graphene_ray_intersect_triangle( self.to_glib_none().0, t.to_glib_none().0, t_out.as_mut_ptr(), )); let t_out = t_out.assume_init(); (ret, t_out) } } #[doc(alias = "graphene_ray_intersects_box")] pub fn intersects_box(&self, b: &Box) -> bool { unsafe { ffi::graphene_ray_intersects_box(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_ray_intersects_sphere")] pub fn intersects_sphere(&self, s: &Sphere) -> bool { unsafe { ffi::graphene_ray_intersects_sphere(self.to_glib_none().0, s.to_glib_none().0) } } #[doc(alias = "graphene_ray_intersects_triangle")] pub fn intersects_triangle(&self, t: &Triangle) -> bool { unsafe { ffi::graphene_ray_intersects_triangle(self.to_glib_none().0, t.to_glib_none().0) } } } impl PartialEq for Ray { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Ray {} graphene-rs-0.14.8/src/auto/rect.rs000064400000000000000000000206710072674642500152310ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Point; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Rect(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_rect_get_type(), ptr as *mut _) as *mut ffi::graphene_rect_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_rect_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_rect_get_type(), } } impl Rect { #[doc(alias = "graphene_rect_contains_point")] pub fn contains_point(&self, p: &Point) -> bool { unsafe { ffi::graphene_rect_contains_point(self.to_glib_none().0, p.to_glib_none().0) } } #[doc(alias = "graphene_rect_contains_rect")] pub fn contains_rect(&self, b: &Rect) -> bool { unsafe { ffi::graphene_rect_contains_rect(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_rect_equal")] fn equal(&self, b: &Rect) -> bool { unsafe { ffi::graphene_rect_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_rect_expand")] pub fn expand(&self, p: &Point) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_rect_expand( self.to_glib_none().0, p.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_rect_get_area")] #[doc(alias = "get_area")] pub fn area(&self) -> f32 { unsafe { ffi::graphene_rect_get_area(self.to_glib_none().0) } } #[doc(alias = "graphene_rect_get_bottom_left")] #[doc(alias = "get_bottom_left")] pub fn bottom_left(&self) -> Point { unsafe { let mut p = Point::uninitialized(); ffi::graphene_rect_get_bottom_left(self.to_glib_none().0, p.to_glib_none_mut().0); p } } #[doc(alias = "graphene_rect_get_bottom_right")] #[doc(alias = "get_bottom_right")] pub fn bottom_right(&self) -> Point { unsafe { let mut p = Point::uninitialized(); ffi::graphene_rect_get_bottom_right(self.to_glib_none().0, p.to_glib_none_mut().0); p } } #[doc(alias = "graphene_rect_get_center")] #[doc(alias = "get_center")] pub fn center(&self) -> Point { unsafe { let mut p = Point::uninitialized(); ffi::graphene_rect_get_center(self.to_glib_none().0, p.to_glib_none_mut().0); p } } #[doc(alias = "graphene_rect_get_height")] #[doc(alias = "get_height")] pub fn height(&self) -> f32 { unsafe { ffi::graphene_rect_get_height(self.to_glib_none().0) } } #[doc(alias = "graphene_rect_get_top_left")] #[doc(alias = "get_top_left")] pub fn top_left(&self) -> Point { unsafe { let mut p = Point::uninitialized(); ffi::graphene_rect_get_top_left(self.to_glib_none().0, p.to_glib_none_mut().0); p } } #[doc(alias = "graphene_rect_get_top_right")] #[doc(alias = "get_top_right")] pub fn top_right(&self) -> Point { unsafe { let mut p = Point::uninitialized(); ffi::graphene_rect_get_top_right(self.to_glib_none().0, p.to_glib_none_mut().0); p } } //#[doc(alias = "graphene_rect_get_vertices")] //#[doc(alias = "get_vertices")] //pub fn vertices(&self, vertices: /*Unimplemented*/FixedArray TypeId { ns_id: 1, id: 16 }; 4) { // unsafe { TODO: call ffi:graphene_rect_get_vertices() } //} #[doc(alias = "graphene_rect_get_width")] #[doc(alias = "get_width")] pub fn width(&self) -> f32 { unsafe { ffi::graphene_rect_get_width(self.to_glib_none().0) } } #[doc(alias = "graphene_rect_get_x")] #[doc(alias = "get_x")] pub fn x(&self) -> f32 { unsafe { ffi::graphene_rect_get_x(self.to_glib_none().0) } } #[doc(alias = "graphene_rect_get_y")] #[doc(alias = "get_y")] pub fn y(&self) -> f32 { unsafe { ffi::graphene_rect_get_y(self.to_glib_none().0) } } #[doc(alias = "graphene_rect_init")] pub fn init(&mut self, x: f32, y: f32, width: f32, height: f32) { unsafe { ffi::graphene_rect_init(self.to_glib_none_mut().0, x, y, width, height); } } #[doc(alias = "graphene_rect_init_from_rect")] pub fn init_from_rect(&mut self, src: &Rect) { unsafe { ffi::graphene_rect_init_from_rect(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_rect_inset")] pub fn inset(&mut self, d_x: f32, d_y: f32) -> Option { unsafe { from_glib_none(ffi::graphene_rect_inset( self.to_glib_none_mut().0, d_x, d_y, )) } } #[doc(alias = "graphene_rect_inset_r")] pub fn inset_r(&self, d_x: f32, d_y: f32) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_rect_inset_r(self.to_glib_none().0, d_x, d_y, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_rect_interpolate")] pub fn interpolate(&self, b: &Rect, factor: f64) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_rect_interpolate( self.to_glib_none().0, b.to_glib_none().0, factor, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_rect_intersection")] pub fn intersection(&self, b: &Rect) -> Option { unsafe { let mut res = Rect::uninitialized(); let ret = ffi::graphene_rect_intersection( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); if ret { Some(res) } else { None } } } #[doc(alias = "graphene_rect_normalize")] pub fn normalize(&mut self) -> Option { unsafe { from_glib_none(ffi::graphene_rect_normalize(self.to_glib_none_mut().0)) } } #[doc(alias = "graphene_rect_normalize_r")] pub fn normalize_r(&self) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_rect_normalize_r(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_rect_offset")] pub fn offset(&mut self, d_x: f32, d_y: f32) -> Option { unsafe { from_glib_none(ffi::graphene_rect_offset( self.to_glib_none_mut().0, d_x, d_y, )) } } #[doc(alias = "graphene_rect_offset_r")] pub fn offset_r(&self, d_x: f32, d_y: f32) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_rect_offset_r(self.to_glib_none().0, d_x, d_y, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_rect_round_extents")] pub fn round_extents(&self) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_rect_round_extents(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_rect_scale")] pub fn scale(&self, s_h: f32, s_v: f32) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_rect_scale(self.to_glib_none().0, s_h, s_v, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_rect_union")] pub fn union(&self, b: &Rect) -> Rect { unsafe { let mut res = Rect::uninitialized(); ffi::graphene_rect_union( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_rect_zero")] pub fn zero() -> Rect { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_rect_zero()) } } } impl PartialEq for Rect { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Rect {} graphene-rs-0.14.8/src/auto/size.rs000064400000000000000000000043430072674642500152440ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Size(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_size_get_type(), ptr as *mut _) as *mut ffi::graphene_size_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_size_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_size_get_type(), } } impl Size { #[doc(alias = "graphene_size_equal")] fn equal(&self, b: &Size) -> bool { unsafe { ffi::graphene_size_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_size_init")] pub fn init(&mut self, width: f32, height: f32) { unsafe { ffi::graphene_size_init(self.to_glib_none_mut().0, width, height); } } #[doc(alias = "graphene_size_init_from_size")] pub fn init_from_size(&mut self, src: &Size) { unsafe { ffi::graphene_size_init_from_size(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_size_interpolate")] pub fn interpolate(&self, b: &Size, factor: f64) -> Size { unsafe { let mut res = Size::uninitialized(); ffi::graphene_size_interpolate( self.to_glib_none().0, b.to_glib_none().0, factor, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_size_scale")] pub fn scale(&self, factor: f32) -> Size { unsafe { let mut res = Size::uninitialized(); ffi::graphene_size_scale(self.to_glib_none().0, factor, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_size_zero")] pub fn zero() -> Size { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_size_zero()) } } } impl PartialEq for Size { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Size {} graphene-rs-0.14.8/src/auto/sphere.rs000064400000000000000000000060550072674642500155620ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Box; use crate::Point3D; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Sphere(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_sphere_get_type(), ptr as *mut _) as *mut ffi::graphene_sphere_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_sphere_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_sphere_get_type(), } } impl Sphere { #[doc(alias = "graphene_sphere_contains_point")] pub fn contains_point(&self, point: &Point3D) -> bool { unsafe { ffi::graphene_sphere_contains_point(self.to_glib_none().0, point.to_glib_none().0) } } #[doc(alias = "graphene_sphere_distance")] pub fn distance(&self, point: &Point3D) -> f32 { unsafe { ffi::graphene_sphere_distance(self.to_glib_none().0, point.to_glib_none().0) } } #[doc(alias = "graphene_sphere_equal")] fn equal(&self, b: &Sphere) -> bool { unsafe { ffi::graphene_sphere_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_sphere_get_bounding_box")] #[doc(alias = "get_bounding_box")] pub fn bounding_box(&self) -> Box { unsafe { let mut box_ = Box::uninitialized(); ffi::graphene_sphere_get_bounding_box(self.to_glib_none().0, box_.to_glib_none_mut().0); box_ } } #[doc(alias = "graphene_sphere_get_center")] #[doc(alias = "get_center")] pub fn center(&self) -> Point3D { unsafe { let mut center = Point3D::uninitialized(); ffi::graphene_sphere_get_center(self.to_glib_none().0, center.to_glib_none_mut().0); center } } #[doc(alias = "graphene_sphere_get_radius")] #[doc(alias = "get_radius")] pub fn radius(&self) -> f32 { unsafe { ffi::graphene_sphere_get_radius(self.to_glib_none().0) } } #[doc(alias = "graphene_sphere_init")] pub fn init(&mut self, center: Option<&Point3D>, radius: f32) { unsafe { ffi::graphene_sphere_init(self.to_glib_none_mut().0, center.to_glib_none().0, radius); } } #[doc(alias = "graphene_sphere_is_empty")] pub fn is_empty(&self) -> bool { unsafe { ffi::graphene_sphere_is_empty(self.to_glib_none().0) } } #[doc(alias = "graphene_sphere_translate")] pub fn translate(&self, point: &Point3D) -> Sphere { unsafe { let mut res = Sphere::uninitialized(); ffi::graphene_sphere_translate( self.to_glib_none().0, point.to_glib_none().0, res.to_glib_none_mut().0, ); res } } } impl PartialEq for Sphere { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Sphere {} graphene-rs-0.14.8/src/auto/triangle.rs000064400000000000000000000144250072674642500161010ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Box; use crate::Plane; use crate::Point3D; use crate::Vec2; use crate::Vec3; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Triangle(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_triangle_get_type(), ptr as *mut _) as *mut ffi::graphene_triangle_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_triangle_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_triangle_get_type(), } } impl Triangle { #[doc(alias = "graphene_triangle_contains_point")] pub fn contains_point(&self, p: &Point3D) -> bool { unsafe { ffi::graphene_triangle_contains_point(self.to_glib_none().0, p.to_glib_none().0) } } #[doc(alias = "graphene_triangle_equal")] fn equal(&self, b: &Triangle) -> bool { unsafe { ffi::graphene_triangle_equal(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_triangle_get_area")] #[doc(alias = "get_area")] pub fn area(&self) -> f32 { unsafe { ffi::graphene_triangle_get_area(self.to_glib_none().0) } } #[doc(alias = "graphene_triangle_get_barycoords")] #[doc(alias = "get_barycoords")] pub fn barycoords(&self, p: Option<&Point3D>) -> Option { unsafe { let mut res = Vec2::uninitialized(); let ret = ffi::graphene_triangle_get_barycoords( self.to_glib_none().0, p.to_glib_none().0, res.to_glib_none_mut().0, ); if ret { Some(res) } else { None } } } #[doc(alias = "graphene_triangle_get_bounding_box")] #[doc(alias = "get_bounding_box")] pub fn bounding_box(&self) -> Box { unsafe { let mut res = Box::uninitialized(); ffi::graphene_triangle_get_bounding_box( self.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_triangle_get_midpoint")] #[doc(alias = "get_midpoint")] pub fn midpoint(&self) -> Point3D { unsafe { let mut res = Point3D::uninitialized(); ffi::graphene_triangle_get_midpoint(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_triangle_get_normal")] #[doc(alias = "get_normal")] pub fn normal(&self) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_triangle_get_normal(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_triangle_get_plane")] #[doc(alias = "get_plane")] pub fn plane(&self) -> Plane { unsafe { let mut res = Plane::uninitialized(); ffi::graphene_triangle_get_plane(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_triangle_get_points")] #[doc(alias = "get_points")] pub fn points(&self) -> (Point3D, Point3D, Point3D) { unsafe { let mut a = Point3D::uninitialized(); let mut b = Point3D::uninitialized(); let mut c = Point3D::uninitialized(); ffi::graphene_triangle_get_points( self.to_glib_none().0, a.to_glib_none_mut().0, b.to_glib_none_mut().0, c.to_glib_none_mut().0, ); (a, b, c) } } #[doc(alias = "graphene_triangle_get_uv")] #[doc(alias = "get_uv")] pub fn uv(&self, p: Option<&Point3D>, uv_a: &Vec2, uv_b: &Vec2, uv_c: &Vec2) -> Option { unsafe { let mut res = Vec2::uninitialized(); let ret = ffi::graphene_triangle_get_uv( self.to_glib_none().0, p.to_glib_none().0, uv_a.to_glib_none().0, uv_b.to_glib_none().0, uv_c.to_glib_none().0, res.to_glib_none_mut().0, ); if ret { Some(res) } else { None } } } #[doc(alias = "graphene_triangle_get_vertices")] #[doc(alias = "get_vertices")] pub fn vertices(&self) -> (Vec3, Vec3, Vec3) { unsafe { let mut a = Vec3::uninitialized(); let mut b = Vec3::uninitialized(); let mut c = Vec3::uninitialized(); ffi::graphene_triangle_get_vertices( self.to_glib_none().0, a.to_glib_none_mut().0, b.to_glib_none_mut().0, c.to_glib_none_mut().0, ); (a, b, c) } } //#[doc(alias = "graphene_triangle_init_from_float")] //pub fn init_from_float(&mut self, a: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 3, b: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 3, c: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 3) -> Option { // unsafe { TODO: call ffi:graphene_triangle_init_from_float() } //} #[doc(alias = "graphene_triangle_init_from_point3d")] pub fn init_from_point3d( &mut self, a: Option<&Point3D>, b: Option<&Point3D>, c: Option<&Point3D>, ) { unsafe { ffi::graphene_triangle_init_from_point3d( self.to_glib_none_mut().0, a.to_glib_none().0, b.to_glib_none().0, c.to_glib_none().0, ); } } #[doc(alias = "graphene_triangle_init_from_vec3")] pub fn init_from_vec3(&mut self, a: Option<&Vec3>, b: Option<&Vec3>, c: Option<&Vec3>) { unsafe { ffi::graphene_triangle_init_from_vec3( self.to_glib_none_mut().0, a.to_glib_none().0, b.to_glib_none().0, c.to_glib_none().0, ); } } } impl PartialEq for Triangle { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Triangle {} graphene-rs-0.14.8/src/auto/vec2.rs000064400000000000000000000152470072674642500151360ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Vec2(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_vec2_get_type(), ptr as *mut _) as *mut ffi::graphene_vec2_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_vec2_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_vec2_get_type(), } } impl Vec2 { #[doc(alias = "graphene_vec2_add")] pub fn add(&self, b: &Vec2) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec2_add( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec2_divide")] pub fn divide(&self, b: &Vec2) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec2_divide( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec2_dot")] pub fn dot(&self, b: &Vec2) -> f32 { unsafe { ffi::graphene_vec2_dot(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_vec2_equal")] fn equal(&self, v2: &Vec2) -> bool { unsafe { ffi::graphene_vec2_equal(self.to_glib_none().0, v2.to_glib_none().0) } } #[doc(alias = "graphene_vec2_get_x")] #[doc(alias = "get_x")] pub fn x(&self) -> f32 { unsafe { ffi::graphene_vec2_get_x(self.to_glib_none().0) } } #[doc(alias = "graphene_vec2_get_y")] #[doc(alias = "get_y")] pub fn y(&self) -> f32 { unsafe { ffi::graphene_vec2_get_y(self.to_glib_none().0) } } #[doc(alias = "graphene_vec2_init")] pub fn init(&mut self, x: f32, y: f32) { unsafe { ffi::graphene_vec2_init(self.to_glib_none_mut().0, x, y); } } //#[doc(alias = "graphene_vec2_init_from_float")] //pub fn init_from_float(&mut self, src: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 2) -> Option { // unsafe { TODO: call ffi:graphene_vec2_init_from_float() } //} #[doc(alias = "graphene_vec2_init_from_vec2")] pub fn init_from_vec2(&mut self, src: &Vec2) { unsafe { ffi::graphene_vec2_init_from_vec2(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_vec2_interpolate")] pub fn interpolate(&self, v2: &Vec2, factor: f64) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec2_interpolate( self.to_glib_none().0, v2.to_glib_none().0, factor, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec2_length")] pub fn length(&self) -> f32 { unsafe { ffi::graphene_vec2_length(self.to_glib_none().0) } } #[doc(alias = "graphene_vec2_max")] pub fn max(&self, b: &Vec2) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec2_max( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec2_min")] pub fn min(&self, b: &Vec2) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec2_min( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec2_multiply")] pub fn multiply(&self, b: &Vec2) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec2_multiply( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec2_near")] pub fn near(&self, v2: &Vec2, epsilon: f32) -> bool { unsafe { ffi::graphene_vec2_near(self.to_glib_none().0, v2.to_glib_none().0, epsilon) } } #[doc(alias = "graphene_vec2_negate")] pub fn negate(&self) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec2_negate(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec2_normalize")] pub fn normalize(&self) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec2_normalize(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec2_scale")] pub fn scale(&self, factor: f32) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec2_scale(self.to_glib_none().0, factor, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec2_subtract")] pub fn subtract(&self, b: &Vec2) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec2_subtract( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } //#[doc(alias = "graphene_vec2_to_float")] //pub fn to_float(&self, dest: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 2) { // unsafe { TODO: call ffi:graphene_vec2_to_float() } //} #[doc(alias = "graphene_vec2_one")] pub fn one() -> Vec2 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec2_one()) } } #[doc(alias = "graphene_vec2_x_axis")] pub fn x_axis() -> Vec2 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec2_x_axis()) } } #[doc(alias = "graphene_vec2_y_axis")] pub fn y_axis() -> Vec2 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec2_y_axis()) } } #[doc(alias = "graphene_vec2_zero")] pub fn zero() -> Vec2 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec2_zero()) } } } impl PartialEq for Vec2 { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Vec2 {} graphene-rs-0.14.8/src/auto/vec3.rs000064400000000000000000000215570072674642500151400ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Vec2; use crate::Vec4; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Vec3(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_vec3_get_type(), ptr as *mut _) as *mut ffi::graphene_vec3_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_vec3_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_vec3_get_type(), } } impl Vec3 { #[doc(alias = "graphene_vec3_add")] pub fn add(&self, b: &Vec3) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_add( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec3_cross")] pub fn cross(&self, b: &Vec3) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_cross( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec3_divide")] pub fn divide(&self, b: &Vec3) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_divide( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec3_dot")] pub fn dot(&self, b: &Vec3) -> f32 { unsafe { ffi::graphene_vec3_dot(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_vec3_equal")] fn equal(&self, v2: &Vec3) -> bool { unsafe { ffi::graphene_vec3_equal(self.to_glib_none().0, v2.to_glib_none().0) } } #[doc(alias = "graphene_vec3_get_x")] #[doc(alias = "get_x")] pub fn x(&self) -> f32 { unsafe { ffi::graphene_vec3_get_x(self.to_glib_none().0) } } #[doc(alias = "graphene_vec3_get_xy")] #[doc(alias = "get_xy")] pub fn xy(&self) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec3_get_xy(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec3_get_xy0")] #[doc(alias = "get_xy0")] pub fn xy0(&self) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_get_xy0(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec3_get_xyz0")] #[doc(alias = "get_xyz0")] pub fn xyz0(&self) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec3_get_xyz0(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec3_get_xyz1")] #[doc(alias = "get_xyz1")] pub fn xyz1(&self) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec3_get_xyz1(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec3_get_xyzw")] #[doc(alias = "get_xyzw")] pub fn xyzw(&self, w: f32) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec3_get_xyzw(self.to_glib_none().0, w, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec3_get_y")] #[doc(alias = "get_y")] pub fn y(&self) -> f32 { unsafe { ffi::graphene_vec3_get_y(self.to_glib_none().0) } } #[doc(alias = "graphene_vec3_get_z")] #[doc(alias = "get_z")] pub fn z(&self) -> f32 { unsafe { ffi::graphene_vec3_get_z(self.to_glib_none().0) } } #[doc(alias = "graphene_vec3_init")] pub fn init(&mut self, x: f32, y: f32, z: f32) { unsafe { ffi::graphene_vec3_init(self.to_glib_none_mut().0, x, y, z); } } //#[doc(alias = "graphene_vec3_init_from_float")] //pub fn init_from_float(&mut self, src: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 3) -> Option { // unsafe { TODO: call ffi:graphene_vec3_init_from_float() } //} #[doc(alias = "graphene_vec3_init_from_vec3")] pub fn init_from_vec3(&mut self, src: &Vec3) { unsafe { ffi::graphene_vec3_init_from_vec3(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_vec3_interpolate")] pub fn interpolate(&self, v2: &Vec3, factor: f64) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_interpolate( self.to_glib_none().0, v2.to_glib_none().0, factor, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec3_length")] pub fn length(&self) -> f32 { unsafe { ffi::graphene_vec3_length(self.to_glib_none().0) } } #[doc(alias = "graphene_vec3_max")] pub fn max(&self, b: &Vec3) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_max( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec3_min")] pub fn min(&self, b: &Vec3) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_min( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec3_multiply")] pub fn multiply(&self, b: &Vec3) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_multiply( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec3_near")] pub fn near(&self, v2: &Vec3, epsilon: f32) -> bool { unsafe { ffi::graphene_vec3_near(self.to_glib_none().0, v2.to_glib_none().0, epsilon) } } #[doc(alias = "graphene_vec3_negate")] pub fn negate(&self) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_negate(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec3_normalize")] pub fn normalize(&self) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_normalize(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec3_scale")] pub fn scale(&self, factor: f32) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_scale(self.to_glib_none().0, factor, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec3_subtract")] pub fn subtract(&self, b: &Vec3) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec3_subtract( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } //#[doc(alias = "graphene_vec3_to_float")] //pub fn to_float(&self, dest: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 3) { // unsafe { TODO: call ffi:graphene_vec3_to_float() } //} #[doc(alias = "graphene_vec3_one")] pub fn one() -> Vec3 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec3_one()) } } #[doc(alias = "graphene_vec3_x_axis")] pub fn x_axis() -> Vec3 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec3_x_axis()) } } #[doc(alias = "graphene_vec3_y_axis")] pub fn y_axis() -> Vec3 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec3_y_axis()) } } #[doc(alias = "graphene_vec3_z_axis")] pub fn z_axis() -> Vec3 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec3_z_axis()) } } #[doc(alias = "graphene_vec3_zero")] pub fn zero() -> Vec3 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec3_zero()) } } } impl PartialEq for Vec3 { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Vec3 {} graphene-rs-0.14.8/src/auto/vec4.rs000064400000000000000000000210650072674642500151330ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Vec2; use crate::Vec3; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Vec4(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_vec4_get_type(), ptr as *mut _) as *mut ffi::graphene_vec4_t, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_vec4_get_type(), ptr as *mut _), init => |_ptr| (), clear => |_ptr| (), type_ => || ffi::graphene_vec4_get_type(), } } impl Vec4 { #[doc(alias = "graphene_vec4_add")] pub fn add(&self, b: &Vec4) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec4_add( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec4_divide")] pub fn divide(&self, b: &Vec4) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec4_divide( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec4_dot")] pub fn dot(&self, b: &Vec4) -> f32 { unsafe { ffi::graphene_vec4_dot(self.to_glib_none().0, b.to_glib_none().0) } } #[doc(alias = "graphene_vec4_equal")] fn equal(&self, v2: &Vec4) -> bool { unsafe { ffi::graphene_vec4_equal(self.to_glib_none().0, v2.to_glib_none().0) } } #[doc(alias = "graphene_vec4_get_w")] #[doc(alias = "get_w")] pub fn w(&self) -> f32 { unsafe { ffi::graphene_vec4_get_w(self.to_glib_none().0) } } #[doc(alias = "graphene_vec4_get_x")] #[doc(alias = "get_x")] pub fn x(&self) -> f32 { unsafe { ffi::graphene_vec4_get_x(self.to_glib_none().0) } } #[doc(alias = "graphene_vec4_get_xy")] #[doc(alias = "get_xy")] pub fn xy(&self) -> Vec2 { unsafe { let mut res = Vec2::uninitialized(); ffi::graphene_vec4_get_xy(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec4_get_xyz")] #[doc(alias = "get_xyz")] pub fn xyz(&self) -> Vec3 { unsafe { let mut res = Vec3::uninitialized(); ffi::graphene_vec4_get_xyz(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec4_get_y")] #[doc(alias = "get_y")] pub fn y(&self) -> f32 { unsafe { ffi::graphene_vec4_get_y(self.to_glib_none().0) } } #[doc(alias = "graphene_vec4_get_z")] #[doc(alias = "get_z")] pub fn z(&self) -> f32 { unsafe { ffi::graphene_vec4_get_z(self.to_glib_none().0) } } #[doc(alias = "graphene_vec4_init")] pub fn init(&mut self, x: f32, y: f32, z: f32, w: f32) { unsafe { ffi::graphene_vec4_init(self.to_glib_none_mut().0, x, y, z, w); } } //#[doc(alias = "graphene_vec4_init_from_float")] //pub fn init_from_float(&mut self, src: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 4) -> Option { // unsafe { TODO: call ffi:graphene_vec4_init_from_float() } //} #[doc(alias = "graphene_vec4_init_from_vec2")] pub fn init_from_vec2(&mut self, src: &Vec2, z: f32, w: f32) { unsafe { ffi::graphene_vec4_init_from_vec2( self.to_glib_none_mut().0, src.to_glib_none().0, z, w, ); } } #[doc(alias = "graphene_vec4_init_from_vec3")] pub fn init_from_vec3(&mut self, src: &Vec3, w: f32) { unsafe { ffi::graphene_vec4_init_from_vec3(self.to_glib_none_mut().0, src.to_glib_none().0, w); } } #[doc(alias = "graphene_vec4_init_from_vec4")] pub fn init_from_vec4(&mut self, src: &Vec4) { unsafe { ffi::graphene_vec4_init_from_vec4(self.to_glib_none_mut().0, src.to_glib_none().0); } } #[doc(alias = "graphene_vec4_interpolate")] pub fn interpolate(&self, v2: &Vec4, factor: f64) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec4_interpolate( self.to_glib_none().0, v2.to_glib_none().0, factor, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec4_length")] pub fn length(&self) -> f32 { unsafe { ffi::graphene_vec4_length(self.to_glib_none().0) } } #[doc(alias = "graphene_vec4_max")] pub fn max(&self, b: &Vec4) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec4_max( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec4_min")] pub fn min(&self, b: &Vec4) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec4_min( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec4_multiply")] pub fn multiply(&self, b: &Vec4) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec4_multiply( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } #[doc(alias = "graphene_vec4_near")] pub fn near(&self, v2: &Vec4, epsilon: f32) -> bool { unsafe { ffi::graphene_vec4_near(self.to_glib_none().0, v2.to_glib_none().0, epsilon) } } #[doc(alias = "graphene_vec4_negate")] pub fn negate(&self) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec4_negate(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec4_normalize")] pub fn normalize(&self) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec4_normalize(self.to_glib_none().0, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec4_scale")] pub fn scale(&self, factor: f32) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec4_scale(self.to_glib_none().0, factor, res.to_glib_none_mut().0); res } } #[doc(alias = "graphene_vec4_subtract")] pub fn subtract(&self, b: &Vec4) -> Vec4 { unsafe { let mut res = Vec4::uninitialized(); ffi::graphene_vec4_subtract( self.to_glib_none().0, b.to_glib_none().0, res.to_glib_none_mut().0, ); res } } //#[doc(alias = "graphene_vec4_to_float")] //pub fn to_float(&self, dest: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 20 }; 4) { // unsafe { TODO: call ffi:graphene_vec4_to_float() } //} #[doc(alias = "graphene_vec4_one")] pub fn one() -> Vec4 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec4_one()) } } #[doc(alias = "graphene_vec4_w_axis")] pub fn w_axis() -> Vec4 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec4_w_axis()) } } #[doc(alias = "graphene_vec4_x_axis")] pub fn x_axis() -> Vec4 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec4_x_axis()) } } #[doc(alias = "graphene_vec4_y_axis")] pub fn y_axis() -> Vec4 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec4_y_axis()) } } #[doc(alias = "graphene_vec4_z_axis")] pub fn z_axis() -> Vec4 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec4_z_axis()) } } #[doc(alias = "graphene_vec4_zero")] pub fn zero() -> Vec4 { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::graphene_vec4_zero()) } } } impl PartialEq for Vec4 { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Vec4 {} graphene-rs-0.14.8/src/auto/versions.txt000064400000000000000000000002040072674642500163250ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ 8891a2f2c34b) from gir-files (https://github.com/gtk-rs/gir-files @ 7d95377690e9) graphene-rs-0.14.8/src/box_.rs000064400000000000000000000076240072674642500142560ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Box; use crate::Point3D; use crate::Vec3; use glib::translate::*; impl Box { #[doc(alias = "graphene_box_get_vertices")] #[doc(alias = "get_vertices")] pub fn vertices(&self) -> [Vec3; 8] { unsafe { let mut out: [ffi::graphene_vec3_t; 8] = std::mem::zeroed(); ffi::graphene_box_get_vertices(self.to_glib_none().0, &mut out as *mut _); [ from_glib_none(&out[0] as *const _), from_glib_none(&out[1] as *const _), from_glib_none(&out[2] as *const _), from_glib_none(&out[3] as *const _), from_glib_none(&out[4] as *const _), from_glib_none(&out[5] as *const _), from_glib_none(&out[6] as *const _), from_glib_none(&out[7] as *const _), ] } } #[doc(alias = "graphene_box_init_from_points")] pub fn init_from_points(&mut self, points: &[&Point3D]) { let vec: Vec<_> = points .iter() .map(|e| unsafe { *e.to_glib_none().0 }) .collect(); let n = vec.len() as u32; unsafe { ffi::graphene_box_init_from_points(self.to_glib_none_mut().0, n, vec.as_ptr()); } } #[doc(alias = "graphene_box_init_from_vectors")] pub fn init_from_vectors(&mut self, vectors: &[&Vec3]) { let vec: Vec<_> = vectors .iter() .map(|e| unsafe { *e.to_glib_none().0 }) .collect(); let n = vec.len() as u32; unsafe { ffi::graphene_box_init_from_vectors(self.to_glib_none_mut().0, n, vec.as_ptr()); } } #[doc(alias = "graphene_box_init")] pub fn new(min: Option<&Point3D>, max: Option<&Point3D>) -> Box { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_box_alloc(); ffi::graphene_box_init(alloc, min.to_glib_none().0, max.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_box_init_from_box")] #[doc(alias = "new_from_box")] pub fn from_box(src: &Box) -> Box { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_box_alloc(); ffi::graphene_box_init_from_box(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_box_init_from_points")] #[doc(alias = "new_from_points")] pub fn from_points(&mut self, points: &[&Point3D]) -> Box { assert_initialized_main_thread!(); let vec: Vec<_> = points .iter() .map(|e| unsafe { *e.to_glib_none().0 }) .collect(); let n = vec.len() as u32; unsafe { let alloc = ffi::graphene_box_alloc(); ffi::graphene_box_init_from_points(alloc, n, vec.as_ptr()); from_glib_full(alloc) } } #[doc(alias = "graphene_box_init_from_vec3")] #[doc(alias = "new_from_vec3")] pub fn from_vec3(min: Option<&Vec3>, max: Option<&Vec3>) -> Box { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_box_alloc(); ffi::graphene_box_init_from_vec3(alloc, min.to_glib_none().0, max.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_box_init_from_vectors")] #[doc(alias = "new_from_vectors")] pub fn from_vectors(vectors: &[&Vec3]) -> Box { assert_initialized_main_thread!(); let vec: Vec<_> = vectors .iter() .map(|e| unsafe { *e.to_glib_none().0 }) .collect(); let n = vec.len() as u32; unsafe { let alloc = ffi::graphene_box_alloc(); ffi::graphene_box_init_from_vectors(alloc, n, vec.as_ptr()); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/euler.rs000064400000000000000000000050260072674642500144350ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Euler; use crate::EulerOrder; use crate::Matrix; use crate::Quaternion; use crate::Vec3; use glib::translate::*; impl Euler { #[doc(alias = "graphene_euler_init")] pub fn new(x: f32, y: f32, z: f32) -> Euler { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_euler_alloc(); ffi::graphene_euler_init(alloc, x, y, z); from_glib_full(alloc) } } #[doc(alias = "graphene_euler_init_from_euler")] #[doc(alias = "new_from_euler")] pub fn from_euler(src: Option<&Euler>) -> Euler { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_euler_alloc(); ffi::graphene_euler_init_from_euler(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_euler_init_from_matrix")] #[doc(alias = "new_from_matrix")] pub fn from_matrix(m: Option<&Matrix>, order: EulerOrder) -> Euler { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_euler_alloc(); ffi::graphene_euler_init_from_matrix(alloc, m.to_glib_none().0, order.into_glib()); from_glib_full(alloc) } } #[doc(alias = "graphene_euler_init_from_quaternion")] #[doc(alias = "new_from_quaternion")] pub fn from_quaternion(q: Option<&Quaternion>, order: EulerOrder) -> Euler { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_euler_alloc(); ffi::graphene_euler_init_from_quaternion(alloc, q.to_glib_none().0, order.into_glib()); from_glib_full(alloc) } } #[doc(alias = "graphene_euler_init_from_vec3")] #[doc(alias = "new_from_vec3")] pub fn from_vec3(v: Option<&Vec3>, order: EulerOrder) -> Euler { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_euler_alloc(); ffi::graphene_euler_init_from_vec3(alloc, v.to_glib_none().0, order.into_glib()); from_glib_full(alloc) } } #[doc(alias = "graphene_euler_init_with_order")] pub fn new_with_order(x: f32, y: f32, z: f32, order: EulerOrder) -> Euler { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_euler_alloc(); ffi::graphene_euler_init_with_order(alloc, x, y, z, order.into_glib()); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/frustum.rs000064400000000000000000000043110072674642500150220ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Frustum; use crate::Matrix; use crate::Plane; use glib::translate::*; impl Frustum { #[doc(alias = "graphene_frustum_get_planes")] #[doc(alias = "get_planes")] pub fn planes(&self) -> [Plane; 6] { unsafe { let mut out: [ffi::graphene_plane_t; 6] = std::mem::zeroed(); ffi::graphene_frustum_get_planes(self.to_glib_none().0, &mut out as *mut _); [ from_glib_none(&out[0] as *const _), from_glib_none(&out[1] as *const _), from_glib_none(&out[2] as *const _), from_glib_none(&out[3] as *const _), from_glib_none(&out[4] as *const _), from_glib_none(&out[5] as *const _), ] } } #[doc(alias = "graphene_frustum_init")] pub fn new(p0: &Plane, p1: &Plane, p2: &Plane, p3: &Plane, p4: &Plane, p5: &Plane) -> Frustum { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_frustum_alloc(); ffi::graphene_frustum_init( alloc, p0.to_glib_none().0, p1.to_glib_none().0, p2.to_glib_none().0, p3.to_glib_none().0, p4.to_glib_none().0, p5.to_glib_none().0, ); from_glib_full(alloc) } } #[doc(alias = "graphene_frustum_init_from_frustum")] #[doc(alias = "new_from_frustum")] pub fn from_frustum(src: &Frustum) -> Frustum { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_frustum_alloc(); ffi::graphene_frustum_init_from_frustum(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_frustum_init_from_matrix")] #[doc(alias = "new_from_matrix")] pub fn from_matrix(matrix: &Matrix) -> Frustum { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_frustum_alloc(); ffi::graphene_frustum_init_from_matrix(alloc, matrix.to_glib_none().0); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/lib.rs000064400000000000000000000017620072674642500140720ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. //! # Rust Graphene bindings //! //! This library contains safe Rust bindings for [Graphene](https://github.com/ebassi/graphene). //! It is a part of [gtk-rs](https://gtk-rs.org/). //! //! Graphene 2.44 is the lowest supported version for the underlying library. #![cfg_attr(feature = "dox", feature(doc_cfg))] pub use ffi; pub use glib; // Graphene has no runtime to initialize macro_rules! assert_initialized_main_thread { () => {}; } // No-op macro_rules! skip_assert_initialized { () => {}; } #[allow(clippy::transmute_ptr_to_ref)] #[allow(clippy::type_complexity)] #[allow(clippy::unreadable_literal)] #[allow(clippy::derive_hash_xor_eq)] #[allow(unused_imports)] mod auto; pub mod prelude; pub use crate::auto::*; mod box_; mod euler; mod frustum; mod matrix; mod plane; mod point; mod point3_d; mod quad; mod quaternion; mod ray; mod rect; mod size; mod sphere; mod triangle; mod vec2; mod vec3; mod vec4; graphene-rs-0.14.8/src/matrix.rs000064400000000000000000000135300072674642500146240ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Matrix; use crate::Point3D; use crate::Vec3; use crate::Vec4; use glib::translate::*; impl Matrix { #[doc(alias = "graphene_matrix_init_from_float")] pub fn init_from_float(&mut self, v: &[f32; 16]) { unsafe { ffi::graphene_matrix_init_from_float(self.to_glib_none_mut().0, v as *const _); } } #[doc(alias = "graphene_matrix_init_from_2d")] #[doc(alias = "new_from_2d")] pub fn from_2d(xx: f64, yx: f64, xy: f64, yy: f64, x_0: f64, y_0: f64) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_from_2d(alloc, xx, yx, xy, yy, x_0, y_0); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_from_float")] #[doc(alias = "new_from_float")] pub fn from_float(v: &[f32; 16]) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_from_float(alloc, v as *const _); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_from_matrix")] #[doc(alias = "new_from_matrix")] pub fn from_matrix(src: &Matrix) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_from_matrix(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_from_vec4")] #[doc(alias = "new_from_vec4")] pub fn from_vec4(v0: &Vec4, v1: &Vec4, v2: &Vec4, v3: &Vec4) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_from_vec4( alloc, v0.to_glib_none().0, v1.to_glib_none().0, v2.to_glib_none().0, v3.to_glib_none().0, ); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_frustum")] pub fn new_frustum( left: f32, right: f32, bottom: f32, top: f32, z_near: f32, z_far: f32, ) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_frustum(alloc, left, right, bottom, top, z_near, z_far); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_identity")] pub fn new_identity() -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_identity(alloc); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_look_at")] pub fn new_look_at(eye: &Vec3, center: &Vec3, up: &Vec3) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_look_at( alloc, eye.to_glib_none().0, center.to_glib_none().0, up.to_glib_none().0, ); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_ortho")] pub fn new_ortho( left: f32, right: f32, top: f32, bottom: f32, z_near: f32, z_far: f32, ) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_ortho(alloc, left, right, top, bottom, z_near, z_far); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_perspective")] pub fn new_perspective(fovy: f32, aspect: f32, z_near: f32, z_far: f32) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_perspective(alloc, fovy, aspect, z_near, z_far); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_rotate")] pub fn new_rotate(angle: f32, axis: &Vec3) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_rotate(alloc, angle, axis.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_scale")] pub fn new_scale(x: f32, y: f32, z: f32) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_scale(alloc, x, y, z); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_skew")] pub fn new_skew(x_skew: f32, y_skew: f32) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_skew(alloc, x_skew, y_skew); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_init_translate")] pub fn new_translate(p: &Point3D) -> Matrix { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_matrix_alloc(); ffi::graphene_matrix_init_translate(alloc, p.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_matrix_to_float")] pub fn to_float(&self) -> [f32; 16] { unsafe { let mut out = std::mem::MaybeUninit::uninit(); ffi::graphene_matrix_to_float(self.to_glib_none().0, out.as_mut_ptr()); out.assume_init() } } } graphene-rs-0.14.8/src/plane.rs000064400000000000000000000044010072674642500144140ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Plane; use crate::Point3D; use crate::Vec3; use crate::Vec4; use glib::translate::*; impl Plane { #[doc(alias = "graphene_plane_init")] pub fn new(normal: Option<&Vec3>, constant: f32) -> Plane { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_plane_alloc(); ffi::graphene_plane_init(alloc, normal.to_glib_none().0, constant); from_glib_full(alloc) } } #[doc(alias = "graphene_plane_init_from_plane")] #[doc(alias = "new_from_plane")] pub fn from_plane(src: &Plane) -> Plane { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_plane_alloc(); ffi::graphene_plane_init_from_plane(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_plane_init_from_point")] #[doc(alias = "new_from_point")] pub fn from_point(normal: &Vec3, point: &Point3D) -> Plane { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_plane_alloc(); ffi::graphene_plane_init_from_point( alloc, normal.to_glib_none().0, point.to_glib_none().0, ); from_glib_full(alloc) } } #[doc(alias = "graphene_plane_init_from_points")] #[doc(alias = "new_from_points")] pub fn from_points(a: &Point3D, b: &Point3D, c: &Point3D) -> Plane { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_plane_alloc(); ffi::graphene_plane_init_from_points( alloc, a.to_glib_none().0, b.to_glib_none().0, c.to_glib_none().0, ); from_glib_full(alloc) } } #[doc(alias = "graphene_plane_init_from_vec4")] #[doc(alias = "new_from_vec4")] pub fn from_vec4(src: &Vec4) -> Plane { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_plane_alloc(); ffi::graphene_plane_init_from_vec4(alloc, src.to_glib_none().0); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/point.rs000064400000000000000000000022650072674642500144540ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Point; use crate::Vec2; use glib::translate::*; impl Point { #[doc(alias = "graphene_point_init")] pub fn new(x: f32, y: f32) -> Point { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_point_alloc(); ffi::graphene_point_init(alloc, x, y); from_glib_full(alloc) } } #[doc(alias = "graphene_point_init_from_point")] #[doc(alias = "new_from_point")] pub fn from_point(src: &Point) -> Point { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_point_alloc(); ffi::graphene_point_init_from_point(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_point_init_from_vec2")] #[doc(alias = "new_from_vec2")] pub fn from_vec2(src: &Vec2) -> Point { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_point_alloc(); ffi::graphene_point_init_from_vec2(alloc, src.to_glib_none().0); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/point3_d.rs000064400000000000000000000023320072674642500150350ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Point3D; use crate::Vec3; use glib::translate::*; impl Point3D { #[doc(alias = "graphene_point3d_init")] pub fn new(x: f32, y: f32, z: f32) -> Point3D { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_point3d_alloc(); ffi::graphene_point3d_init(alloc, x, y, z); from_glib_full(alloc) } } #[doc(alias = "graphene_point3d_init_from_point")] #[doc(alias = "new_from_point")] pub fn from_point(src: &Point3D) -> Point3D { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_point3d_alloc(); ffi::graphene_point3d_init_from_point(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_point3d_init_from_vec3")] #[doc(alias = "new_from_vec3")] pub fn from_vec3(v: &Vec3) -> Point3D { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_point3d_alloc(); ffi::graphene_point3d_init_from_vec3(alloc, v.to_glib_none().0); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/prelude.rs000064400000000000000000000003040072674642500147530ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. //! Traits intended for blanket imports. pub use crate::auto::traits::*; #[doc(hidden)] pub use glib::prelude::*; graphene-rs-0.14.8/src/quad.rs000064400000000000000000000041010072674642500142440ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Point; use crate::Quad; use crate::Rect; use glib::translate::*; impl Quad { #[doc(alias = "graphene_quad_init_from_points")] pub fn init_from_points(&mut self, points: &[&Point; 4]) { unsafe { let points = [ *points[0].to_glib_none().0, *points[1].to_glib_none().0, *points[2].to_glib_none().0, *points[3].to_glib_none().0, ]; ffi::graphene_quad_init_from_points(self.to_glib_none_mut().0, &points as *const _); } } #[doc(alias = "graphene_quad_init")] pub fn new(p1: &Point, p2: &Point, p3: &Point, p4: &Point) -> Quad { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quad_alloc(); ffi::graphene_quad_init( alloc, p1.to_glib_none().0, p2.to_glib_none().0, p3.to_glib_none().0, p4.to_glib_none().0, ); from_glib_full(alloc) } } #[doc(alias = "graphene_quad_init_from_rect")] #[doc(alias = "new_from_rect")] pub fn from_rect(r: &Rect) -> Quad { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quad_alloc(); ffi::graphene_quad_init_from_rect(alloc, r.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_quad_init_from_points")] #[doc(alias = "new_from_points")] pub fn from_points(points: &[&Point; 4]) -> Quad { assert_initialized_main_thread!(); unsafe { let points = [ *points[0].to_glib_none().0, *points[1].to_glib_none().0, *points[2].to_glib_none().0, *points[3].to_glib_none().0, ]; let alloc = ffi::graphene_quad_alloc(); ffi::graphene_quad_init_from_points(alloc, &points as *const _); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/quaternion.rs000064400000000000000000000073110072674642500155050ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Euler; use crate::Matrix; use crate::Quaternion; use crate::Vec3; use crate::Vec4; use glib::translate::*; impl Quaternion { #[doc(alias = "graphene_quaternion_init")] pub fn new(x: f32, y: f32, z: f32, w: f32) -> Quaternion { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quaternion_alloc(); ffi::graphene_quaternion_init(alloc, x, y, z, w); from_glib_full(alloc) } } #[doc(alias = "graphene_quaternion_init_from_angle_vec3")] #[doc(alias = "new_from_angle_vec3")] pub fn from_angle_vec3(angle: f32, axis: &Vec3) -> Quaternion { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quaternion_alloc(); ffi::graphene_quaternion_init_from_angle_vec3(alloc, angle, axis.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_quaternion_init_from_angles")] #[doc(alias = "new_from_angles")] pub fn from_angles(deg_x: f32, deg_y: f32, deg_z: f32) -> Quaternion { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quaternion_alloc(); ffi::graphene_quaternion_init_from_angles(alloc, deg_x, deg_y, deg_z); from_glib_full(alloc) } } #[doc(alias = "graphene_quaternion_init_from_euler")] #[doc(alias = "new_from_euler")] pub fn from_euler(e: &Euler) -> Quaternion { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quaternion_alloc(); ffi::graphene_quaternion_init_from_euler(alloc, e.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_quaternion_init_from_matrix")] #[doc(alias = "new_from_matrix")] pub fn from_matrix(m: &Matrix) -> Quaternion { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quaternion_alloc(); ffi::graphene_quaternion_init_from_matrix(alloc, m.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_quaternion_init_from_quaternion")] #[doc(alias = "new_from_quaternion")] pub fn from_quaternion(src: &Quaternion) -> Quaternion { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quaternion_alloc(); ffi::graphene_quaternion_init_from_quaternion(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_quaternion_init_from_radians")] #[doc(alias = "new_from_radians")] pub fn from_radians(rad_x: f32, rad_y: f32, rad_z: f32) -> Quaternion { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quaternion_alloc(); ffi::graphene_quaternion_init_from_radians(alloc, rad_x, rad_y, rad_z); from_glib_full(alloc) } } #[doc(alias = "graphene_quaternion_init_from_vec4")] #[doc(alias = "new_from_vec4")] pub fn from_vec4(src: &Vec4) -> Quaternion { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quaternion_alloc(); ffi::graphene_quaternion_init_from_vec4(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_quaternion_init_identity")] pub fn new_identity() -> Quaternion { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_quaternion_alloc(); ffi::graphene_quaternion_init_identity(alloc); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/ray.rs000064400000000000000000000025710072674642500141160ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Point3D; use crate::Ray; use crate::Vec3; use glib::translate::*; impl Ray { #[doc(alias = "graphene_ray_init")] pub fn new(origin: Option<&Point3D>, direction: Option<&Vec3>) -> Ray { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_ray_alloc(); ffi::graphene_ray_init(alloc, origin.to_glib_none().0, direction.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_ray_init_from_ray")] #[doc(alias = "new_from_ray")] pub fn from_ray(src: &Ray) -> Ray { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_ray_alloc(); ffi::graphene_ray_init_from_ray(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_ray_init_from_vec3")] #[doc(alias = "new_from_vec3")] pub fn from_vec3(origin: Option<&Vec3>, direction: Option<&Vec3>) -> Ray { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_ray_alloc(); ffi::graphene_ray_init_from_vec3( alloc, origin.to_glib_none().0, direction.to_glib_none().0, ); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/rect.rs000064400000000000000000000026120072674642500142540ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Rect; use crate::Vec2; use glib::translate::*; impl Rect { #[doc(alias = "graphene_rect_get_vertices")] #[doc(alias = "get_vertices")] pub fn vertices(&self) -> [Vec2; 4] { unsafe { let mut out: [ffi::graphene_vec2_t; 4] = std::mem::zeroed(); ffi::graphene_rect_get_vertices(self.to_glib_none().0, &mut out as *mut _); [ from_glib_none(&out[0] as *const _), from_glib_none(&out[1] as *const _), from_glib_none(&out[2] as *const _), from_glib_none(&out[3] as *const _), ] } } #[doc(alias = "graphene_rect_init")] pub fn new(x: f32, y: f32, width: f32, height: f32) -> Rect { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_rect_alloc(); ffi::graphene_rect_init(alloc, x, y, width, height); from_glib_full(alloc) } } #[doc(alias = "graphene_rect_init_from_rect")] #[doc(alias = "new_from_rect")] pub fn from_rect(src: &Rect) -> Rect { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_rect_alloc(); ffi::graphene_rect_init_from_rect(alloc, src.to_glib_none().0); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/size.rs000064400000000000000000000014620072674642500142730ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Size; use glib::translate::*; impl Size { #[doc(alias = "graphene_size_init")] pub fn new(width: f32, height: f32) -> Size { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_size_alloc(); ffi::graphene_size_init(alloc, width, height); from_glib_full(alloc) } } #[doc(alias = "graphene_size_init_from_size")] #[doc(alias = "new_from_size")] pub fn from_size(src: &Size) -> Size { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_size_alloc(); ffi::graphene_size_init_from_size(alloc, src.to_glib_none().0); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/sphere.rs000064400000000000000000000054150072674642500146110ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Point3D; use crate::Sphere; use crate::Vec3; use glib::translate::*; impl Sphere { #[doc(alias = "graphene_sphere_init_from_points")] pub fn init_from_points(&mut self, points: &[&Point3D], center: Option<&Point3D>) { let vec: Vec<_> = points .iter() .map(|e| unsafe { *e.to_glib_none().0 }) .collect(); let n = vec.len() as u32; unsafe { ffi::graphene_sphere_init_from_points( self.to_glib_none_mut().0, n, vec.as_ptr(), center.to_glib_none().0, ); } } #[doc(alias = "graphene_sphere_init_from_vectors")] pub fn init_from_vectors(&mut self, vectors: &[&Vec3], center: Option<&Point3D>) { let vec: Vec<_> = vectors .iter() .map(|e| unsafe { *e.to_glib_none().0 }) .collect(); let n = vec.len() as u32; unsafe { ffi::graphene_sphere_init_from_vectors( self.to_glib_none_mut().0, n, vec.as_ptr(), center.to_glib_none().0, ); } } #[doc(alias = "graphene_sphere_init")] pub fn new(center: Option<&Point3D>, radius: f32) -> Sphere { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_sphere_alloc(); ffi::graphene_sphere_init(alloc, center.to_glib_none().0, radius); from_glib_full(alloc) } } #[doc(alias = "graphene_sphere_init_from_points")] #[doc(alias = "new_from_points")] pub fn from_points(points: &[&Point3D], center: Option<&Point3D>) -> Sphere { assert_initialized_main_thread!(); let vec: Vec<_> = points .iter() .map(|e| unsafe { *e.to_glib_none().0 }) .collect(); let n = vec.len() as u32; unsafe { let alloc = ffi::graphene_sphere_alloc(); ffi::graphene_sphere_init_from_points(alloc, n, vec.as_ptr(), center.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_sphere_init_from_vectors")] #[doc(alias = "new_from_vectors")] pub fn from_vectors(vectors: &[&Vec3], center: Option<&Point3D>) -> Sphere { assert_initialized_main_thread!(); let vec: Vec<_> = vectors .iter() .map(|e| unsafe { *e.to_glib_none().0 }) .collect(); let n = vec.len() as u32; unsafe { let alloc = ffi::graphene_sphere_alloc(); ffi::graphene_sphere_init_from_vectors(alloc, n, vec.as_ptr(), center.to_glib_none().0); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/triangle.rs000064400000000000000000000024120072674642500151220ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Point3D; use crate::Triangle; use crate::Vec3; use glib::translate::*; impl Triangle { #[doc(alias = "graphene_triangle_init_from_point3d")] #[doc(alias = "new_from_point3d")] pub fn from_point3d(a: Option<&Point3D>, b: Option<&Point3D>, c: Option<&Point3D>) -> Triangle { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_triangle_alloc(); ffi::graphene_triangle_init_from_point3d( alloc, a.to_glib_none().0, b.to_glib_none().0, c.to_glib_none().0, ); from_glib_full(alloc) } } #[doc(alias = "graphene_triangle_init_from_vec3")] #[doc(alias = "new_from_vec3")] pub fn from_vec3(a: Option<&Vec3>, b: Option<&Vec3>, c: Option<&Vec3>) -> Triangle { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_triangle_alloc(); ffi::graphene_triangle_init_from_vec3( alloc, a.to_glib_none().0, b.to_glib_none().0, c.to_glib_none().0, ); from_glib_full(alloc) } } } graphene-rs-0.14.8/src/vec2.rs000064400000000000000000000032410072674642500141550ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Vec2; use glib::translate::*; impl Vec2 { #[doc(alias = "graphene_vec2_init_from_float")] pub fn init_from_float(&mut self, src: &[f32; 2]) { unsafe { ffi::graphene_vec2_init_from_float(self.to_glib_none_mut().0, src as *const _); } } #[doc(alias = "graphene_vec2_init")] pub fn new(x: f32, y: f32) -> Vec2 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec2_alloc(); ffi::graphene_vec2_init(alloc, x, y); from_glib_full(alloc) } } #[doc(alias = "graphene_vec2_init_from_vec2")] #[doc(alias = "new_from_vec2")] pub fn from_vec2(src: &Vec2) -> Vec2 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec2_alloc(); ffi::graphene_vec2_init_from_vec2(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_vec2_init_from_float")] #[doc(alias = "new_from_float")] pub fn from_float(src: &[f32; 2]) -> Vec2 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec2_alloc(); ffi::graphene_vec2_init_from_float(alloc, src as *const _); from_glib_full(alloc) } } #[doc(alias = "graphene_vec2_to_float")] pub fn to_float(&self) -> [f32; 2] { unsafe { let mut out = std::mem::MaybeUninit::uninit(); ffi::graphene_vec2_to_float(self.to_glib_none().0, out.as_mut_ptr()); out.assume_init() } } } graphene-rs-0.14.8/src/vec3.rs000064400000000000000000000032540072674642500141620ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Vec3; use glib::translate::*; impl Vec3 { #[doc(alias = "graphene_vec3_init_from_float")] pub fn init_from_float(&mut self, src: &[f32; 3]) { unsafe { ffi::graphene_vec3_init_from_float(self.to_glib_none_mut().0, src as *const _); } } #[doc(alias = "graphene_vec3_init")] pub fn new(x: f32, y: f32, z: f32) -> Vec3 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec3_alloc(); ffi::graphene_vec3_init(alloc, x, y, z); from_glib_full(alloc) } } #[doc(alias = "graphene_vec3_init_from_vec3")] #[doc(alias = "new_from_vec3")] pub fn from_vec3(src: &Vec3) -> Vec3 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec3_alloc(); ffi::graphene_vec3_init_from_vec3(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_vec3_init_from_float")] #[doc(alias = "new_from_float")] pub fn from_float(src: &[f32; 3]) -> Vec3 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec3_alloc(); ffi::graphene_vec3_init_from_float(alloc, src as *const _); from_glib_full(alloc) } } #[doc(alias = "graphene_vec3_to_float")] pub fn to_float(&self) -> [f32; 3] { unsafe { let mut out = std::mem::MaybeUninit::uninit(); ffi::graphene_vec3_to_float(self.to_glib_none().0, out.as_mut_ptr()); out.assume_init() } } } graphene-rs-0.14.8/src/vec4.rs000064400000000000000000000047340072674642500141670ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Vec2; use crate::Vec3; use crate::Vec4; use glib::translate::*; impl Vec4 { #[doc(alias = "graphene_vec4_init_from_float")] pub fn init_from_float(&mut self, src: &[f32; 4]) { unsafe { ffi::graphene_vec4_init_from_float(self.to_glib_none_mut().0, src as *const _); } } #[doc(alias = "graphene_vec4_init")] pub fn new(x: f32, y: f32, z: f32, w: f32) -> Vec4 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec4_alloc(); ffi::graphene_vec4_init(alloc, x, y, z, w); from_glib_full(alloc) } } #[doc(alias = "graphene_vec4_init_from_vec2")] #[doc(alias = "new_from_vec2")] pub fn from_vec2(src: &Vec2, z: f32, w: f32) -> Vec4 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec4_alloc(); ffi::graphene_vec4_init_from_vec2(alloc, src.to_glib_none().0, z, w); from_glib_full(alloc) } } #[doc(alias = "graphene_vec4_init_from_vec3")] #[doc(alias = "new_from_vec3")] pub fn from_vec3(src: &Vec3, w: f32) -> Vec4 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec4_alloc(); ffi::graphene_vec4_init_from_vec3(alloc, src.to_glib_none().0, w); from_glib_full(alloc) } } #[doc(alias = "graphene_vec4_init_from_vec4")] #[doc(alias = "new_from_vec4")] pub fn from_vec4(src: &Vec4) -> Vec4 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec4_alloc(); ffi::graphene_vec4_init_from_vec4(alloc, src.to_glib_none().0); from_glib_full(alloc) } } #[doc(alias = "graphene_vec4_init_from_float")] #[doc(alias = "new_from_float")] pub fn from_float(src: &[f32; 4]) -> Vec4 { assert_initialized_main_thread!(); unsafe { let alloc = ffi::graphene_vec4_alloc(); ffi::graphene_vec4_init_from_float(alloc, src as *const _); from_glib_full(alloc) } } #[doc(alias = "graphene_vec4_to_float")] pub fn to_float(&self) -> [f32; 4] { unsafe { let mut out = std::mem::MaybeUninit::uninit(); ffi::graphene_vec4_to_float(self.to_glib_none().0, out.as_mut_ptr()); out.assume_init() } } } graphene-rs-0.14.8/tests/check_gir.rs000064400000000000000000000003640072674642500156120ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); println!("{}", res.to_string()); assert_eq!(res.nb_errors, 0); }