#[repr(C)]pub struct Rgba {
pub red: f32,
pub green: f32,
pub blue: f32,
pub alpha: f32,
}
Expand description
Fields§
§red: f32
Red channel value, in the [0.0..=1.0]
range.
green: f32
Green channel value, in the [0.0..=1.0]
range.
blue: f32
Blue channel value, in the [0.0..=1.0]
range.
alpha: f32
Alpha channel value, in the [0.0..=1.0]
range.
Implementations§
Source§impl Rgba
impl Rgba
Sourcepub fn new<C: Into<RgbaComponent>, A: Into<RgbaComponent>>(
red: C,
green: C,
blue: C,
alpha: A,
) -> Rgba
pub fn new<C: Into<RgbaComponent>, A: Into<RgbaComponent>>( red: C, green: C, blue: C, alpha: A, ) -> Rgba
New from RGB of a the same type and A that can be of a different type.
Sourcepub fn set_red<R: Into<RgbaComponent>>(&mut self, red: R)
pub fn set_red<R: Into<RgbaComponent>>(&mut self, red: R)
Set the red
component from any type that converts to RgbaComponent
.
Sourcepub fn set_green<G: Into<RgbaComponent>>(&mut self, green: G)
pub fn set_green<G: Into<RgbaComponent>>(&mut self, green: G)
Set the green
component from any type that converts to RgbaComponent
.
Sourcepub fn set_blue<B: Into<RgbaComponent>>(&mut self, blue: B)
pub fn set_blue<B: Into<RgbaComponent>>(&mut self, blue: B)
Set the blue
component from any type that converts to RgbaComponent
.
Sourcepub fn set_alpha<A: Into<RgbaComponent>>(&mut self, alpha: A)
pub fn set_alpha<A: Into<RgbaComponent>>(&mut self, alpha: A)
Set the alpha
component from any type that converts to RgbaComponent
.
Sourcepub fn with_red<R: Into<RgbaComponent>>(self, red: R) -> Self
pub fn with_red<R: Into<RgbaComponent>>(self, red: R) -> Self
Returns a copy of the color with a new red
value.
Sourcepub fn with_green<R: Into<RgbaComponent>>(self, green: R) -> Self
pub fn with_green<R: Into<RgbaComponent>>(self, green: R) -> Self
Returns a copy of the color with a new green
value.
Sourcepub fn with_blue<B: Into<RgbaComponent>>(self, blue: B) -> Self
pub fn with_blue<B: Into<RgbaComponent>>(self, blue: B) -> Self
Returns a copy of the color with a new blue
value.
Sourcepub fn with_alpha<A: Into<RgbaComponent>>(self, alpha: A) -> Self
pub fn with_alpha<A: Into<RgbaComponent>>(self, alpha: A) -> Self
Returns a copy of the color with a new alpha
value.
Sourcepub fn transparent(self) -> Self
pub fn transparent(self) -> Self
Returns a copy of the color with the alpha set to 0
.
Trait Implementations§
Source§impl AddAssign for Rgba
impl AddAssign for Rgba
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+=
operation. Read moreSource§impl<'de> Deserialize<'de> for Rgba
impl<'de> Deserialize<'de> for Rgba
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl SubAssign for Rgba
impl SubAssign for Rgba
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-=
operation. Read more