-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db6658f
commit 2e3f126
Showing
4 changed files
with
91 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// 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::{Path, PathPoint}; | ||
use glib::translate::*; | ||
|
||
glib::wrapper! { | ||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
pub struct PathMeasure(Shared<ffi::GskPathMeasure>); | ||
|
||
match fn { | ||
ref => |ptr| ffi::gsk_path_measure_ref(ptr), | ||
unref => |ptr| ffi::gsk_path_measure_unref(ptr), | ||
type_ => || ffi::gsk_path_measure_get_type(), | ||
} | ||
} | ||
|
||
impl PathMeasure { | ||
#[doc(alias = "gsk_path_measure_new")] | ||
pub fn new(path: &Path) -> PathMeasure { | ||
assert_initialized_main_thread!(); | ||
unsafe { from_glib_full(ffi::gsk_path_measure_new(path.to_glib_none().0)) } | ||
} | ||
|
||
#[doc(alias = "gsk_path_measure_new_with_tolerance")] | ||
#[doc(alias = "new_with_tolerance")] | ||
pub fn with_tolerance(path: &Path, tolerance: f32) -> PathMeasure { | ||
assert_initialized_main_thread!(); | ||
unsafe { | ||
from_glib_full(ffi::gsk_path_measure_new_with_tolerance( | ||
path.to_glib_none().0, | ||
tolerance, | ||
)) | ||
} | ||
} | ||
|
||
#[doc(alias = "gsk_path_measure_get_length")] | ||
#[doc(alias = "get_length")] | ||
pub fn length(&self) -> f32 { | ||
unsafe { ffi::gsk_path_measure_get_length(self.to_glib_none().0) } | ||
} | ||
|
||
#[doc(alias = "gsk_path_measure_get_path")] | ||
#[doc(alias = "get_path")] | ||
pub fn path(&self) -> Path { | ||
unsafe { from_glib_none(ffi::gsk_path_measure_get_path(self.to_glib_none().0)) } | ||
} | ||
|
||
#[doc(alias = "gsk_path_measure_get_point")] | ||
#[doc(alias = "get_point")] | ||
pub fn point(&self, distance: f32) -> Option<PathPoint> { | ||
unsafe { | ||
let mut result = PathPoint::uninitialized(); | ||
let ret = from_glib(ffi::gsk_path_measure_get_point( | ||
self.to_glib_none().0, | ||
distance, | ||
result.to_glib_none_mut().0, | ||
)); | ||
if ret { | ||
Some(result) | ||
} else { | ||
None | ||
} | ||
} | ||
} | ||
|
||
#[doc(alias = "gsk_path_measure_get_tolerance")] | ||
#[doc(alias = "get_tolerance")] | ||
pub fn tolerance(&self) -> f32 { | ||
unsafe { ffi::gsk_path_measure_get_tolerance(self.to_glib_none().0) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters