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
sourceimpl 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 RefUnwindSafe for RGBA
impl Send for RGBA
impl Sync for RGBA
impl Unpin for RGBA
impl UnwindSafe for RGBA
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more