gsk4/auto/
path_builder.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, Path, PathPoint, RoundedRect};
6use glib::translate::*;
7
8glib::wrapper! {
9    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
10    pub struct PathBuilder(Shared<ffi::GskPathBuilder>);
11
12    match fn {
13        ref => |ptr| ffi::gsk_path_builder_ref(ptr),
14        unref => |ptr| ffi::gsk_path_builder_unref(ptr),
15        type_ => || ffi::gsk_path_builder_get_type(),
16    }
17}
18
19impl PathBuilder {
20    #[doc(alias = "gsk_path_builder_new")]
21    pub fn new() -> PathBuilder {
22        assert_initialized_main_thread!();
23        unsafe { from_glib_full(ffi::gsk_path_builder_new()) }
24    }
25
26    #[doc(alias = "gsk_path_builder_add_circle")]
27    pub fn add_circle(&self, center: &graphene::Point, radius: f32) {
28        unsafe {
29            ffi::gsk_path_builder_add_circle(
30                self.to_glib_none().0,
31                center.to_glib_none().0,
32                radius,
33            );
34        }
35    }
36
37    #[doc(alias = "gsk_path_builder_add_layout")]
38    pub fn add_layout(&self, layout: &pango::Layout) {
39        unsafe {
40            ffi::gsk_path_builder_add_layout(self.to_glib_none().0, layout.to_glib_none().0);
41        }
42    }
43
44    #[doc(alias = "gsk_path_builder_add_path")]
45    pub fn add_path(&self, path: &Path) {
46        unsafe {
47            ffi::gsk_path_builder_add_path(self.to_glib_none().0, path.to_glib_none().0);
48        }
49    }
50
51    #[doc(alias = "gsk_path_builder_add_rect")]
52    pub fn add_rect(&self, rect: &graphene::Rect) {
53        unsafe {
54            ffi::gsk_path_builder_add_rect(self.to_glib_none().0, rect.to_glib_none().0);
55        }
56    }
57
58    #[doc(alias = "gsk_path_builder_add_reverse_path")]
59    pub fn add_reverse_path(&self, path: &Path) {
60        unsafe {
61            ffi::gsk_path_builder_add_reverse_path(self.to_glib_none().0, path.to_glib_none().0);
62        }
63    }
64
65    #[doc(alias = "gsk_path_builder_add_rounded_rect")]
66    pub fn add_rounded_rect(&self, rect: &RoundedRect) {
67        unsafe {
68            ffi::gsk_path_builder_add_rounded_rect(self.to_glib_none().0, rect.to_glib_none().0);
69        }
70    }
71
72    #[doc(alias = "gsk_path_builder_add_segment")]
73    pub fn add_segment(&self, path: &Path, start: &PathPoint, end: &PathPoint) {
74        unsafe {
75            ffi::gsk_path_builder_add_segment(
76                self.to_glib_none().0,
77                path.to_glib_none().0,
78                start.to_glib_none().0,
79                end.to_glib_none().0,
80            );
81        }
82    }
83
84    #[doc(alias = "gsk_path_builder_arc_to")]
85    pub fn arc_to(&self, x1: f32, y1: f32, x2: f32, y2: f32) {
86        unsafe {
87            ffi::gsk_path_builder_arc_to(self.to_glib_none().0, x1, y1, x2, y2);
88        }
89    }
90
91    #[doc(alias = "gsk_path_builder_close")]
92    pub fn close(&self) {
93        unsafe {
94            ffi::gsk_path_builder_close(self.to_glib_none().0);
95        }
96    }
97
98    #[doc(alias = "gsk_path_builder_conic_to")]
99    pub fn conic_to(&self, x1: f32, y1: f32, x2: f32, y2: f32, weight: f32) {
100        unsafe {
101            ffi::gsk_path_builder_conic_to(self.to_glib_none().0, x1, y1, x2, y2, weight);
102        }
103    }
104
105    #[doc(alias = "gsk_path_builder_cubic_to")]
106    pub fn cubic_to(&self, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32) {
107        unsafe {
108            ffi::gsk_path_builder_cubic_to(self.to_glib_none().0, x1, y1, x2, y2, x3, y3);
109        }
110    }
111
112    #[doc(alias = "gsk_path_builder_get_current_point")]
113    #[doc(alias = "get_current_point")]
114    pub fn current_point(&self) -> graphene::Point {
115        unsafe {
116            from_glib_none(ffi::gsk_path_builder_get_current_point(
117                self.to_glib_none().0,
118            ))
119        }
120    }
121
122    #[doc(alias = "gsk_path_builder_html_arc_to")]
123    pub fn html_arc_to(&self, x1: f32, y1: f32, x2: f32, y2: f32, radius: f32) {
124        unsafe {
125            ffi::gsk_path_builder_html_arc_to(self.to_glib_none().0, x1, y1, x2, y2, radius);
126        }
127    }
128
129    #[doc(alias = "gsk_path_builder_line_to")]
130    pub fn line_to(&self, x: f32, y: f32) {
131        unsafe {
132            ffi::gsk_path_builder_line_to(self.to_glib_none().0, x, y);
133        }
134    }
135
136    #[doc(alias = "gsk_path_builder_move_to")]
137    pub fn move_to(&self, x: f32, y: f32) {
138        unsafe {
139            ffi::gsk_path_builder_move_to(self.to_glib_none().0, x, y);
140        }
141    }
142
143    #[doc(alias = "gsk_path_builder_quad_to")]
144    pub fn quad_to(&self, x1: f32, y1: f32, x2: f32, y2: f32) {
145        unsafe {
146            ffi::gsk_path_builder_quad_to(self.to_glib_none().0, x1, y1, x2, y2);
147        }
148    }
149
150    #[doc(alias = "gsk_path_builder_rel_arc_to")]
151    pub fn rel_arc_to(&self, x1: f32, y1: f32, x2: f32, y2: f32) {
152        unsafe {
153            ffi::gsk_path_builder_rel_arc_to(self.to_glib_none().0, x1, y1, x2, y2);
154        }
155    }
156
157    #[doc(alias = "gsk_path_builder_rel_conic_to")]
158    pub fn rel_conic_to(&self, x1: f32, y1: f32, x2: f32, y2: f32, weight: f32) {
159        unsafe {
160            ffi::gsk_path_builder_rel_conic_to(self.to_glib_none().0, x1, y1, x2, y2, weight);
161        }
162    }
163
164    #[doc(alias = "gsk_path_builder_rel_cubic_to")]
165    pub fn rel_cubic_to(&self, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32) {
166        unsafe {
167            ffi::gsk_path_builder_rel_cubic_to(self.to_glib_none().0, x1, y1, x2, y2, x3, y3);
168        }
169    }
170
171    #[doc(alias = "gsk_path_builder_rel_html_arc_to")]
172    pub fn rel_html_arc_to(&self, x1: f32, y1: f32, x2: f32, y2: f32, radius: f32) {
173        unsafe {
174            ffi::gsk_path_builder_rel_html_arc_to(self.to_glib_none().0, x1, y1, x2, y2, radius);
175        }
176    }
177
178    #[doc(alias = "gsk_path_builder_rel_line_to")]
179    pub fn rel_line_to(&self, x: f32, y: f32) {
180        unsafe {
181            ffi::gsk_path_builder_rel_line_to(self.to_glib_none().0, x, y);
182        }
183    }
184
185    #[doc(alias = "gsk_path_builder_rel_move_to")]
186    pub fn rel_move_to(&self, x: f32, y: f32) {
187        unsafe {
188            ffi::gsk_path_builder_rel_move_to(self.to_glib_none().0, x, y);
189        }
190    }
191
192    #[doc(alias = "gsk_path_builder_rel_quad_to")]
193    pub fn rel_quad_to(&self, x1: f32, y1: f32, x2: f32, y2: f32) {
194        unsafe {
195            ffi::gsk_path_builder_rel_quad_to(self.to_glib_none().0, x1, y1, x2, y2);
196        }
197    }
198
199    #[doc(alias = "gsk_path_builder_rel_svg_arc_to")]
200    pub fn rel_svg_arc_to(
201        &self,
202        rx: f32,
203        ry: f32,
204        x_axis_rotation: f32,
205        large_arc: bool,
206        positive_sweep: bool,
207        x: f32,
208        y: f32,
209    ) {
210        unsafe {
211            ffi::gsk_path_builder_rel_svg_arc_to(
212                self.to_glib_none().0,
213                rx,
214                ry,
215                x_axis_rotation,
216                large_arc.into_glib(),
217                positive_sweep.into_glib(),
218                x,
219                y,
220            );
221        }
222    }
223
224    #[doc(alias = "gsk_path_builder_svg_arc_to")]
225    pub fn svg_arc_to(
226        &self,
227        rx: f32,
228        ry: f32,
229        x_axis_rotation: f32,
230        large_arc: bool,
231        positive_sweep: bool,
232        x: f32,
233        y: f32,
234    ) {
235        unsafe {
236            ffi::gsk_path_builder_svg_arc_to(
237                self.to_glib_none().0,
238                rx,
239                ry,
240                x_axis_rotation,
241                large_arc.into_glib(),
242                positive_sweep.into_glib(),
243                x,
244                y,
245            );
246        }
247    }
248
249    #[doc(alias = "gsk_path_builder_to_path")]
250    pub fn to_path(&self) -> Path {
251        unsafe { from_glib_full(ffi::gsk_path_builder_to_path(self.to_glib_none().0)) }
252    }
253}
254
255#[cfg(feature = "v4_14")]
256#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
257impl Default for PathBuilder {
258    fn default() -> Self {
259        Self::new()
260    }
261}