#[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 moreimpl Copy 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
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)
clone_to_uninit
)