#[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, 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
.
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 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
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 Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.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
)§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