#[repr(C)]pub struct Rgba {
pub red: f32,
pub green: f32,
pub blue: f32,
pub alpha: f32,
}Expand description
Fields§
§red: f32Red channel value, in the [0.0..=1.0] range.
green: f32Green channel value, in the [0.0..=1.0] range.
blue: f32Blue channel value, in the [0.0..=1.0] range.
alpha: f32Alpha channel value, in the [0.0..=1.0] range.
Implementations§
Source§impl Rgba
impl Rgba
Sourcepub fn new<C, A>(red: C, green: C, blue: C, alpha: A) -> Rgba
pub fn new<C, A>(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>(&mut self, red: R)where
R: Into<RgbaComponent>,
pub fn set_red<R>(&mut self, red: R)where
R: Into<RgbaComponent>,
Set the red component from any type that converts to RgbaComponent.
Sourcepub fn set_green<G>(&mut self, green: G)where
G: Into<RgbaComponent>,
pub fn set_green<G>(&mut self, green: G)where
G: Into<RgbaComponent>,
Set the green component from any type that converts to RgbaComponent.
Sourcepub fn set_blue<B>(&mut self, blue: B)where
B: Into<RgbaComponent>,
pub fn set_blue<B>(&mut self, blue: B)where
B: Into<RgbaComponent>,
Set the blue component from any type that converts to RgbaComponent.
Sourcepub fn set_alpha<A>(&mut self, alpha: A)where
A: Into<RgbaComponent>,
pub fn set_alpha<A>(&mut self, alpha: A)where
A: Into<RgbaComponent>,
Set the alpha component from any type that converts to RgbaComponent.
Sourcepub fn with_red<R>(self, red: R) -> Rgbawhere
R: Into<RgbaComponent>,
pub fn with_red<R>(self, red: R) -> Rgbawhere
R: Into<RgbaComponent>,
Returns a copy of the color with a new red value.
Sourcepub fn with_green<R>(self, green: R) -> Rgbawhere
R: Into<RgbaComponent>,
pub fn with_green<R>(self, green: R) -> Rgbawhere
R: Into<RgbaComponent>,
Returns a copy of the color with a new green value.
Sourcepub fn with_blue<B>(self, blue: B) -> Rgbawhere
B: Into<RgbaComponent>,
pub fn with_blue<B>(self, blue: B) -> Rgbawhere
B: Into<RgbaComponent>,
Returns a copy of the color with a new blue value.
Sourcepub fn with_alpha<A>(self, alpha: A) -> Rgbawhere
A: Into<RgbaComponent>,
pub fn with_alpha<A>(self, alpha: A) -> Rgbawhere
A: Into<RgbaComponent>,
Returns a copy of the color with a new alpha value.
Sourcepub fn transparent(self) -> Rgba
pub fn transparent(self) -> Rgba
Returns a copy of the color with the alpha set to 0.
Sourcepub fn to_bgra_bytes(self) -> [u8; 4]
pub fn to_bgra_bytes(self) -> [u8; 4]
Convert a copy to [B, G, R, A] bytes.
Trait Implementations§
Source§impl AddAssign for Rgba
impl AddAssign for Rgba
Source§fn add_assign(&mut self, rhs: Rgba)
fn add_assign(&mut self, rhs: Rgba)
+= operation. Read moreSource§impl<'de> Deserialize<'de> for Rgba
impl<'de> Deserialize<'de> for Rgba
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Rgba, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Rgba, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl FromStr for Rgba
Parses "#RRGGBBAA", #RRGGBB, "rgba(u8, u8, u8, u8)" and "rgb(u8, u8, u8)".
impl FromStr for Rgba
Parses "#RRGGBBAA", #RRGGBB, "rgba(u8, u8, u8, u8)" and "rgb(u8, u8, u8)".
Source§impl Ord for Rgba
impl Ord for Rgba
Source§impl PartialOrd for Rgba
impl PartialOrd for Rgba
Source§impl Serialize for Rgba
impl Serialize for Rgba
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl SubAssign for Rgba
impl SubAssign for Rgba
Source§fn sub_assign(&mut self, rhs: Rgba)
fn sub_assign(&mut self, rhs: Rgba)
-= operation. Read moreSource§impl Transitionable for Rgba
impl Transitionable for Rgba
impl Copy for Rgba
impl Eq 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> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more