#[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 From<PreMulRgba> for Rgba
impl From<PreMulRgba> for Rgba
Source§fn from(c: PreMulRgba) -> Rgba
fn from(c: PreMulRgba) -> Rgba
Source§impl From<Rgba> for BorderSide
impl From<Rgba> for BorderSide
Source§fn from(color: Rgba) -> BorderSide
fn from(color: Rgba) -> BorderSide
Solid color.
Source§impl From<Rgba> for BorderSides
impl From<Rgba> for BorderSides
Source§fn from(color: Rgba) -> BorderSides
fn from(color: Rgba) -> BorderSides
All sides solid color.
Source§impl From<Rgba> for GradientStop
impl From<Rgba> for GradientStop
Source§fn from(positional_color: Rgba) -> GradientStop
fn from(positional_color: Rgba) -> GradientStop
Conversion to positional color.
Source§impl From<Rgba> for PreMulRgba
impl From<Rgba> for PreMulRgba
Source§fn from(c: Rgba) -> PreMulRgba
fn from(c: Rgba) -> PreMulRgba
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 IntoVar<BorderSide> for Rgba
impl IntoVar<BorderSide> for Rgba
Source§fn into_var(self) -> Var<BorderSide>
fn into_var(self) -> Var<BorderSide>
Solid color.
Source§impl IntoVar<BorderSides> for Rgba
impl IntoVar<BorderSides> for Rgba
Source§fn into_var(self) -> Var<BorderSides>
fn into_var(self) -> Var<BorderSides>
All sides solid color.
Source§impl IntoVar<GradientStop> for Rgba
impl IntoVar<GradientStop> for Rgba
Source§fn into_var(self) -> Var<GradientStop>
fn into_var(self) -> Var<GradientStop>
Conversion to positional color.
Source§impl IntoVar<PreMulRgba> for Rgba
impl IntoVar<PreMulRgba> for Rgba
fn into_var(self) -> Var<PreMulRgba>
Source§impl MixAdjust for Rgba
impl MixAdjust for Rgba
Source§fn mix_normal(self, background: Rgba) -> Rgba
fn mix_normal(self, background: Rgba) -> Rgba
Source§fn mix_multiply(self, background: Rgba) -> Rgba
fn mix_multiply(self, background: Rgba) -> Rgba
Source§fn mix_screen(self, background: Rgba) -> Rgba
fn mix_screen(self, background: Rgba) -> Rgba
Source§fn mix_overlay(self, background: Rgba) -> Rgba
fn mix_overlay(self, background: Rgba) -> Rgba
Source§fn mix_darken(self, background: Rgba) -> Rgba
fn mix_darken(self, background: Rgba) -> Rgba
Source§fn mix_lighten(self, background: Rgba) -> Rgba
fn mix_lighten(self, background: Rgba) -> Rgba
Source§fn mix_colordodge(self, background: Rgba) -> Rgba
fn mix_colordodge(self, background: Rgba) -> Rgba
Source§fn mix_colorburn(self, background: Rgba) -> Rgba
fn mix_colorburn(self, background: Rgba) -> Rgba
Source§fn mix_hardlight(self, background: Rgba) -> Rgba
fn mix_hardlight(self, background: Rgba) -> Rgba
Source§fn mix_softlight(self, background: Rgba) -> Rgba
fn mix_softlight(self, background: Rgba) -> Rgba
Source§fn mix_difference(self, background: Rgba) -> Rgba
fn mix_difference(self, background: Rgba) -> Rgba
Source§fn mix_exclusion(self, background: Rgba) -> Rgba
fn mix_exclusion(self, background: Rgba) -> Rgba
Source§fn mix_pluslighter(self, background: Rgba) -> Rgba
fn mix_pluslighter(self, background: Rgba) -> Rgba
Source§fn mix_saturation(self, background: Rgba) -> Rgba
fn mix_saturation(self, background: Rgba) -> Rgba
Source§fn mix_luminosity(self, background: Rgba) -> Rgba
fn mix_luminosity(self, background: Rgba) -> Rgba
Source§fn darken<A>(self, amount: A) -> Rgba
fn darken<A>(self, amount: A) -> Rgba
amount from the color lightness. Read moreSource§fn desaturate<A>(self, amount: A) -> Rgba
fn desaturate<A>(self, amount: A) -> Rgba
amount from the color saturation. Read moreSource§fn with_lightness<L>(self, lightness: L) -> Rgba
fn with_lightness<L>(self, lightness: L) -> Rgba
lightness.Source§fn mix(self, mode: MixBlendMode, background: Self) -> Selfwhere
Self: Sized,
fn mix(self, mode: MixBlendMode, background: Self) -> Selfwhere
Self: Sized,
self over background using the mode.Source§impl Ord for Rgba
impl Ord for Rgba
Source§impl PartialOrd for Rgba
impl PartialOrd for Rgba
Source§impl PxToWr for Rgba
impl PxToWr 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
impl IntoValue<BorderSide> for Rgba
impl IntoValue<BorderSides> for Rgba
impl IntoValue<ColorStop> for Rgba
impl IntoValue<GradientStop> for Rgba
impl IntoValue<Hsla> for Rgba
impl IntoValue<Hsva> for Rgba
impl IntoValue<LightDark> for Rgba
impl IntoValue<PreMulRgba> for Rgba
impl IntoValue<Rgba> for AnsiColor
impl IntoValue<Rgba> for Hsla
impl IntoValue<Rgba> for Hsva
impl IntoValue<Rgba> for PreMulRgba
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§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> DataNoteValue for T
impl<T> DataNoteValue for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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
key and return true if they are equal.§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
Source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy. Read more