pub struct Srgba {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}
Expand description
Represents a color composed of a red, green and blue component in the sRGB color space. In addition, the alpha value determines the how transparent the color is (0 is fully transparent and 255 is fully opaque).
Fields§
§r: u8
Red component
g: u8
Green component
b: u8
Blue component
a: u8
Alpha component
Implementations§
source§impl Srgba
impl Srgba
sourcepub const fn new(r: u8, g: u8, b: u8, a: u8) -> Srgba
pub const fn new(r: u8, g: u8, b: u8, a: u8) -> Srgba
Creates a new sRGBA color with the given values.
sourcepub const fn new_opaque(r: u8, g: u8, b: u8) -> Srgba
pub const fn new_opaque(r: u8, g: u8, b: u8) -> Srgba
Creates a new sRGB color with the given red, green and blue values and an alpha value of 255.
sourcepub fn to_linear_srgb(&self) -> Vector4<f32>
pub fn to_linear_srgb(&self) -> Vector4<f32>
Returns the color in linear sRGB color space.
Trait Implementations§
source§impl Ord for Srgba
impl Ord for Srgba
source§impl PartialEq for Srgba
impl PartialEq for Srgba
source§impl PartialOrd for Srgba
impl PartialOrd for Srgba
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Srgba
impl Eq for Srgba
impl StructuralPartialEq for Srgba
Auto Trait Implementations§
impl RefUnwindSafe for Srgba
impl Send for Srgba
impl Sync for Srgba
impl Unpin for Srgba
impl UnwindSafe for Srgba
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