Skip to content

Commit

Permalink
gdk: Add with_* constructors for RGBA
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaDve committed Aug 16, 2023
1 parent f27af90 commit 61dac70
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions gdk4/src/rgba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,40 @@ impl RGBA {
}
}

#[inline]
pub const fn with_red(self, red: f32) -> Self {
Self {
inner: ffi::GdkRGBA { red, ..self.inner },
}
}

#[inline]
pub const fn with_green(self, green: f32) -> Self {
Self {
inner: ffi::GdkRGBA {
green,
..self.inner
},
}
}

#[inline]
pub const fn with_blue(self, blue: f32) -> Self {
Self {
inner: ffi::GdkRGBA { blue, ..self.inner },
}
}

#[inline]
pub const fn with_alpha(self, alpha: f32) -> Self {
Self {
inner: ffi::GdkRGBA {
alpha,
..self.inner
},
}
}

// rustdoc-stripper-ignore-next
/// Creates a new builder-pattern struct instance to construct [`RGBA`] objects.
///
Expand Down

0 comments on commit 61dac70

Please sign in to comment.