From 68114bd7dc1781fdf7c31822f64bc12ef267eae0 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Thu, 21 Mar 2024 23:38:43 +0100 Subject: [PATCH] add fn to check if completely opaque --- hui/src/rect/color.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hui/src/rect/color.rs b/hui/src/rect/color.rs index 1933b0e..acbe104 100644 --- a/hui/src/rect/color.rs +++ b/hui/src/rect/color.rs @@ -30,6 +30,16 @@ impl FillColor { self.0.bottom_right.w == 0. } + /// Check if the fill color is completely opaque + /// + /// (i.e. all corners have an alpha value of 1.0) + pub fn is_opaque(&self) -> bool { + self.0.top_left.w == 1. && + self.0.top_right.w == 1. && + self.0.bottom_left.w == 1. && + self.0.bottom_right.w == 1. + } + /// Construct a solid color fill from values representing the red, green, blue and alpha channels pub const fn rgba(r: f32, g: f32, b: f32, a: f32) -> Self { Self(Corners {