pub struct RGBA {
pub red: u8,
pub green: u8,
pub blue: u8,
pub alpha: u8,
}
Expand description
A color with red, green, blue, and alpha components, in a byte each.
Fields§
§red: u8
The red component.
green: u8
The green component.
blue: u8
The blue component.
alpha: u8
The alpha component.
Implementations§
source§impl RGBA
impl RGBA
sourcepub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> RGBA
pub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> RGBA
Constructs a new RGBA value from float components. It expects the red, green, blue and alpha channels in that order, and all values will be clamped to the 0.0 … 1.0 range.
sourcepub fn transparent() -> RGBA
pub fn transparent() -> RGBA
Returns a transparent color.
sourcepub fn new(red: u8, green: u8, blue: u8, alpha: u8) -> RGBA
pub fn new(red: u8, green: u8, blue: u8, alpha: u8) -> RGBA
Same thing, but with u8
values instead of floats in the 0 to 1 range.
sourcepub fn red_f32(&self) -> f32
pub fn red_f32(&self) -> f32
Returns the red channel in a floating point number form, from 0 to 1.
sourcepub fn green_f32(&self) -> f32
pub fn green_f32(&self) -> f32
Returns the green channel in a floating point number form, from 0 to 1.
Trait Implementations§
source§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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl MallocSizeOf for RGBA
impl MallocSizeOf for RGBA
source§fn size_of(&self, _: &mut MallocSizeOfOps) -> usize
fn size_of(&self, _: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl PartialEq<RGBA> for RGBA
impl PartialEq<RGBA> 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,
Serialize this value into the given Serde serializer. Read more
source§impl ToAnimatedValue for RGBA
impl ToAnimatedValue for RGBA
§type AnimatedValue = RGBA
type AnimatedValue = RGBA
The type of the animated value.
source§fn to_animated_value(self) -> Self::AnimatedValue
fn to_animated_value(self) -> Self::AnimatedValue
Converts this value to an animated value.
source§fn from_animated_value(animated: Self::AnimatedValue) -> Self
fn from_animated_value(animated: Self::AnimatedValue) -> Self
Converts back an animated value into a computed value.
source§impl ToResolvedValue for RGBA
impl ToResolvedValue for RGBA
§type ResolvedValue = RGBA
type ResolvedValue = RGBA
The resolved value type we’re going to be converted to.
source§fn to_resolved_value(self, _: &Context<'_>) -> Self
fn to_resolved_value(self, _: &Context<'_>) -> Self
Convert a resolved value to a resolved value.
source§fn from_resolved_value(resolved: Self::ResolvedValue) -> Self
fn from_resolved_value(resolved: Self::ResolvedValue) -> Self
Convert a resolved value to resolved value form.
source§impl ToShmem for RGBA
impl ToShmem for RGBA
source§fn to_shmem(
&self,
_builder: &mut SharedMemoryBuilder
) -> Result<ManuallyDrop<RGBA>, String>
fn to_shmem(
&self,
_builder: &mut SharedMemoryBuilder
) -> Result<ManuallyDrop<RGBA>, String>
Clones this value into a form suitable for writing into a
SharedMemoryBuilder. Read more
impl Copy for RGBA
impl StructuralPartialEq for RGBA
Auto Trait Implementations§
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> 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> MaybeBoxed<Box<T, Global>> for T
impl<T> MaybeBoxed<Box<T, Global>> for T
source§fn maybe_boxed(self) -> Box<T, Global>
fn maybe_boxed(self) -> Box<T, Global>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert