Skip to content

Commit

Permalink
gsk: Stroke API fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Aug 12, 2023
1 parent d352922 commit 058a96e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 16 deletions.
20 changes: 19 additions & 1 deletion gsk4/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ generate = [
"Gsk.RoundedClipNode",
"Gsk.ScalingFilter",
"Gsk.SerializationError",
"Gsk.Stroke",
"Gsk.StrokeNode",
"Gsk.TextureNode",
"Gsk.TextureScaleNode",
Expand Down Expand Up @@ -234,6 +233,25 @@ status = "generate"
name = "get_shadow"
manual = true # assert that i < n_shadows

[[object]]
name = "Gsk.Stroke"
status = "generate"
[[object.function]]
name = "to_cairo"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
pattern = "set_(dash|dash_offset|line_cap|line_join|line_width|miter_limit)"
[[object.function.parameter]]
name = "self"
const = true
[[object.function]]
name = "equal"
[[object.function.parameter]]
name = "stroke2"
nullable = false

[[object]]
name = "Gsk.TextNode"
status = "generate"
Expand Down
37 changes: 22 additions & 15 deletions gsk4/src/auto/stroke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,57 +68,64 @@ impl Stroke {
}

#[doc(alias = "gsk_stroke_set_dash")]
pub fn set_dash(&mut self, dash: &[f32]) {
pub fn set_dash(&self, dash: &[f32]) {
let n_dash = dash.len() as _;
unsafe {
ffi::gsk_stroke_set_dash(self.to_glib_none_mut().0, dash.to_glib_none().0, n_dash);
ffi::gsk_stroke_set_dash(
mut_override(self.to_glib_none().0),
dash.to_glib_none().0,
n_dash,
);
}
}

#[doc(alias = "gsk_stroke_set_dash_offset")]
pub fn set_dash_offset(&mut self, offset: f32) {
pub fn set_dash_offset(&self, offset: f32) {
unsafe {
ffi::gsk_stroke_set_dash_offset(self.to_glib_none_mut().0, offset);
ffi::gsk_stroke_set_dash_offset(mut_override(self.to_glib_none().0), offset);
}
}

#[doc(alias = "gsk_stroke_set_line_cap")]
pub fn set_line_cap(&mut self, line_cap: LineCap) {
pub fn set_line_cap(&self, line_cap: LineCap) {
unsafe {
ffi::gsk_stroke_set_line_cap(self.to_glib_none_mut().0, line_cap.into_glib());
ffi::gsk_stroke_set_line_cap(mut_override(self.to_glib_none().0), line_cap.into_glib());
}
}

#[doc(alias = "gsk_stroke_set_line_join")]
pub fn set_line_join(&mut self, line_join: LineJoin) {
pub fn set_line_join(&self, line_join: LineJoin) {
unsafe {
ffi::gsk_stroke_set_line_join(self.to_glib_none_mut().0, line_join.into_glib());
ffi::gsk_stroke_set_line_join(
mut_override(self.to_glib_none().0),
line_join.into_glib(),
);
}
}

#[doc(alias = "gsk_stroke_set_line_width")]
pub fn set_line_width(&mut self, line_width: f32) {
pub fn set_line_width(&self, line_width: f32) {
unsafe {
ffi::gsk_stroke_set_line_width(self.to_glib_none_mut().0, line_width);
ffi::gsk_stroke_set_line_width(mut_override(self.to_glib_none().0), line_width);
}
}

#[doc(alias = "gsk_stroke_set_miter_limit")]
pub fn set_miter_limit(&mut self, limit: f32) {
pub fn set_miter_limit(&self, limit: f32) {
unsafe {
ffi::gsk_stroke_set_miter_limit(self.to_glib_none_mut().0, limit);
ffi::gsk_stroke_set_miter_limit(mut_override(self.to_glib_none().0), limit);
}
}

#[doc(alias = "gsk_stroke_to_cairo")]
pub fn to_cairo(&self, cr: &mut cairo::Context) {
pub fn to_cairo(&self, cr: &cairo::Context) {
unsafe {
ffi::gsk_stroke_to_cairo(self.to_glib_none().0, cr.to_glib_none_mut().0);
ffi::gsk_stroke_to_cairo(self.to_glib_none().0, mut_override(cr.to_glib_none().0));
}
}

#[doc(alias = "gsk_stroke_equal")]
fn equal(&self, stroke2: Option<&Stroke>) -> bool {
fn equal(&self, stroke2: &Stroke) -> bool {
assert_initialized_main_thread!();
unsafe {
from_glib(ffi::gsk_stroke_equal(
Expand Down

0 comments on commit 058a96e

Please sign in to comment.