1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
// Generated by gir (https://github.com/gtk-rs/gir @ 36917718ae60)
// from
// from gir-files (https://github.com/gtk-rs/gir-files @ 4488813a3fc3)
// DO NOT EDIT
use crate::{ffi, Matrix3};
use glib::translate::*;
glib::wrapper! {
#[doc(alias = "GeglPath")]
pub struct Path(Object<ffi::GeglPath, ffi::GeglPathClass>);
match fn {
type_ => || ffi::gegl_path_get_type(),
}
}
impl Path {
#[doc(alias = "gegl_path_new")]
pub fn new() -> Path {
unsafe { from_glib_full(ffi::gegl_path_new()) }
}
#[doc(alias = "gegl_path_new_from_string")]
#[doc(alias = "new_from_string")]
pub fn from_string(instructions: &str) -> Path {
unsafe {
from_glib_full(ffi::gegl_path_new_from_string(
instructions.to_glib_none().0,
))
}
}
//#[doc(alias = "gegl_path_append")]
//pub fn append(&self, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
// unsafe { TODO: call ffi:gegl_path_append() }
//}
#[doc(alias = "gegl_path_calc")]
pub fn calc(&self, pos: f64) -> Option<(f64, f64)> {
unsafe {
let mut x = std::mem::MaybeUninit::uninit();
let mut y = std::mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gegl_path_calc(
self.to_glib_none().0,
pos,
x.as_mut_ptr(),
y.as_mut_ptr(),
));
if ret {
Some((x.assume_init(), y.assume_init()))
} else {
None
}
}
}
#[doc(alias = "gegl_path_calc_y_for_x")]
pub fn calc_y_for_x(&self, x: f64) -> (i32, f64) {
unsafe {
let mut y = std::mem::MaybeUninit::uninit();
let ret = ffi::gegl_path_calc_y_for_x(self.to_glib_none().0, x, y.as_mut_ptr());
(ret, y.assume_init())
}
}
#[doc(alias = "gegl_path_clear")]
pub fn clear(&self) {
unsafe {
ffi::gegl_path_clear(self.to_glib_none().0);
}
}
#[doc(alias = "gegl_path_closest_point")]
pub fn closest_point(&self, x: f64, y: f64) -> (f64, f64, f64, i32) {
unsafe {
let mut on_path_x = std::mem::MaybeUninit::uninit();
let mut on_path_y = std::mem::MaybeUninit::uninit();
let mut node_pos_before = std::mem::MaybeUninit::uninit();
let ret = ffi::gegl_path_closest_point(
self.to_glib_none().0,
x,
y,
on_path_x.as_mut_ptr(),
on_path_y.as_mut_ptr(),
node_pos_before.as_mut_ptr(),
);
(
ret,
on_path_x.assume_init(),
on_path_y.assume_init(),
node_pos_before.assume_init(),
)
}
}
#[doc(alias = "gegl_path_dirty")]
pub fn dirty(&self) {
unsafe {
ffi::gegl_path_dirty(self.to_glib_none().0);
}
}
//#[doc(alias = "gegl_path_foreach")]
//pub fn foreach(&self, each_item: /*Unimplemented*/FnMut(/*Ignored*/PathItem), user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gegl_path_foreach() }
//}
//#[doc(alias = "gegl_path_foreach_flat")]
//pub fn foreach_flat(&self, each_item: /*Unimplemented*/FnMut(/*Ignored*/PathItem), user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gegl_path_foreach_flat() }
//}
#[doc(alias = "gegl_path_freeze")]
pub fn freeze(&self) {
unsafe {
ffi::gegl_path_freeze(self.to_glib_none().0);
}
}
#[doc(alias = "gegl_path_get_bounds")]
#[doc(alias = "get_bounds")]
pub fn bounds(&self) -> (f64, f64, f64, f64) {
unsafe {
let mut min_x = std::mem::MaybeUninit::uninit();
let mut max_x = std::mem::MaybeUninit::uninit();
let mut min_y = std::mem::MaybeUninit::uninit();
let mut max_y = std::mem::MaybeUninit::uninit();
ffi::gegl_path_get_bounds(
self.to_glib_none().0,
min_x.as_mut_ptr(),
max_x.as_mut_ptr(),
min_y.as_mut_ptr(),
max_y.as_mut_ptr(),
);
(
min_x.assume_init(),
max_x.assume_init(),
min_y.assume_init(),
max_y.assume_init(),
)
}
}
//#[doc(alias = "gegl_path_get_flat_path")]
//#[doc(alias = "get_flat_path")]
//pub fn flat_path(&self) -> /*Ignored*/Option<PathList> {
// unsafe { TODO: call ffi:gegl_path_get_flat_path() }
//}
#[doc(alias = "gegl_path_get_length")]
#[doc(alias = "get_length")]
pub fn length(&self) -> f64 {
unsafe { ffi::gegl_path_get_length(self.to_glib_none().0) }
}
#[doc(alias = "gegl_path_get_n_nodes")]
#[doc(alias = "get_n_nodes")]
pub fn n_nodes(&self) -> i32 {
unsafe { ffi::gegl_path_get_n_nodes(self.to_glib_none().0) }
}
//#[doc(alias = "gegl_path_get_node")]
//#[doc(alias = "get_node")]
//pub fn node(&self, index: i32, node: /*Ignored*/PathItem) -> bool {
// unsafe { TODO: call ffi:gegl_path_get_node() }
//}
//#[doc(alias = "gegl_path_get_path")]
//#[doc(alias = "get_path")]
//pub fn path(&self) -> /*Ignored*/Option<PathList> {
// unsafe { TODO: call ffi:gegl_path_get_path() }
//}
//#[doc(alias = "gegl_path_insert_node")]
//pub fn insert_node(&self, pos: i32, node: /*Ignored*/&PathItem) {
// unsafe { TODO: call ffi:gegl_path_insert_node() }
//}
#[doc(alias = "gegl_path_is_empty")]
pub fn is_empty(&self) -> bool {
unsafe { from_glib(ffi::gegl_path_is_empty(self.to_glib_none().0)) }
}
#[doc(alias = "gegl_path_parse_string")]
pub fn parse_string(&self, instructions: &str) {
unsafe {
ffi::gegl_path_parse_string(self.to_glib_none().0, instructions.to_glib_none().0);
}
}
#[doc(alias = "gegl_path_remove_node")]
pub fn remove_node(&self, pos: i32) {
unsafe {
ffi::gegl_path_remove_node(self.to_glib_none().0, pos);
}
}
//#[doc(alias = "gegl_path_replace_node")]
//pub fn replace_node(&self, pos: i32, node: /*Ignored*/&PathItem) {
// unsafe { TODO: call ffi:gegl_path_replace_node() }
//}
#[doc(alias = "gegl_path_set_matrix")]
pub fn set_matrix(&self, matrix: &mut Matrix3) {
unsafe {
ffi::gegl_path_set_matrix(self.to_glib_none().0, matrix.to_glib_none_mut().0);
}
}
#[doc(alias = "gegl_path_thaw")]
pub fn thaw(&self) {
unsafe {
ffi::gegl_path_thaw(self.to_glib_none().0);
}
}
#[doc(alias = "gegl_path_to_string")]
#[doc(alias = "to_string")]
pub fn to_str(&self) -> glib::GString {
unsafe { from_glib_full(ffi::gegl_path_to_string(self.to_glib_none().0)) }
}
//#[doc(alias = "gegl_path_add_flattener")]
//pub fn add_flattener(func: /*Unimplemented*/Fn() -> /*Ignored*/PathList) {
// unsafe { TODO: call ffi:gegl_path_add_flattener() }
//}
#[doc(alias = "gegl_path_add_type")]
pub fn add_type(type_: glib::Char, items: i32, description: &str) {
unsafe {
ffi::gegl_path_add_type(type_.into_glib(), items, description.to_glib_none().0);
}
}
//#[doc(alias = "changed")]
//pub fn connect_changed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Unimplemented object: *.Pointer
//}
}
impl Default for Path {
fn default() -> Self {
Self::new()
}
}
impl std::fmt::Display for Path {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(&self.to_str())
}
}