#[repr(C)]pub struct RGBA {
pub red: u8,
pub green: u8,
pub blue: u8,
pub alpha: u8,
}
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.
Trait Implementations§
impl Copy for RGBA
impl StructuralPartialEq for RGBA
Auto Trait Implementations§
impl Freeze for RGBA
impl RefUnwindSafe for RGBA
impl Send for RGBA
impl Sync for RGBA
impl Unpin for RGBA
impl UnwindSafe for RGBA
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)