Expand description
A color with red, green, blue, and alpha components, in a byte each.
Fields§
§red: u8
The red component.
green: u8
The green component.
blue: u8
The blue component.
alpha: u8
The alpha component.
Implementations§
source§impl RGBA
impl RGBA
sourcepub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Self
pub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Self
Constructs a new RGBA value from float components. It expects the red, green, blue and alpha channels in that order, and all values will be clamped to the 0.0 … 1.0 range.
sourcepub fn transparent() -> Self
pub fn transparent() -> Self
Returns a transparent color.
sourcepub fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self
pub fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self
Same thing, but with u8
values instead of floats in the 0 to 1 range.
sourcepub fn red_f32(&self) -> f32
pub fn red_f32(&self) -> f32
Returns the red channel in a floating point number form, from 0 to 1.
sourcepub fn green_f32(&self) -> f32
pub fn green_f32(&self) -> f32
Returns the green channel in a floating point number form, from 0 to 1.