Struct smart_leds::RGBA
#[repr(C)]pub struct RGBA<ComponentType, AlphaComponentType = ComponentType> {
pub r: ComponentType,
pub g: ComponentType,
pub b: ComponentType,
pub a: AlphaComponentType,
}
Expand description
The RGBA pixel
The component type can be u8
(aliased as RGBA8
), u16
(aliased as RGBA16
),
or any other type (but simple copyable types are recommended.)
You can specify a different type for alpha, but it’s only for special cases
(e.g. if you use a newtype like RGBA<LinearLight<u16>, u16>
).
Fields§
§r: ComponentType
Red
g: ComponentType
Green
b: ComponentType
Blue
a: AlphaComponentType
Alpha
Implementations§
§impl<T, A> RGBA<T, A>where
T: Clone,
impl<T, A> RGBA<T, A>where
T: Clone,
pub fn bgr(&self) -> BGR<T>
pub fn bgr(&self) -> BGR<T>
Copy RGB components out of the RGBA struct
Note: you can use .into()
to convert between other types
Trait Implementations§
§impl<T> AddAssign<T> for RGBA<T>
impl<T> AddAssign<T> for RGBA<T>
px + 1
§fn add_assign(&mut self, r: T)
fn add_assign(&mut self, r: T)
Performs the
+=
operation. Read more§impl<T, A> AddAssign for RGBA<T, A>
impl<T, A> AddAssign for RGBA<T, A>
px + px
§fn add_assign(&mut self, other: RGBA<T, A>)
fn add_assign(&mut self, other: RGBA<T, A>)
Performs the
+=
operation. Read more§impl<T> DivAssign<T> for RGBA<T>
impl<T> DivAssign<T> for RGBA<T>
px * 1
§fn div_assign(&mut self, r: T)
fn div_assign(&mut self, r: T)
Performs the
/=
operation. Read more§impl<T, A> From<(T, T, T, A)> for RGBA<T, A>
impl<T, A> From<(T, T, T, A)> for RGBA<T, A>
§fn from(other: (T, T, T, A)) -> RGBA<T, A>
fn from(other: (T, T, T, A)) -> RGBA<T, A>
Converts to this type from the input type.
§impl<T> FromIterator<T> for RGBA<T>
impl<T> FromIterator<T> for RGBA<T>
§fn from_iter<I>(into_iter: I) -> RGBA<T>where
I: IntoIterator<Item = T>,
fn from_iter<I>(into_iter: I) -> RGBA<T>where
I: IntoIterator<Item = T>,
Takes exactly 4 elements from the iterator and creates a new instance. Panics if there are fewer elements in the iterator.
§impl<T, A> Into<(T, T, T, A)> for RGBA<T, A>
impl<T, A> Into<(T, T, T, A)> for RGBA<T, A>
§fn into(self) -> (T, T, T, A)
fn into(self) -> (T, T, T, A)
Converts this type into the (usually inferred) input type.
§impl<T> MulAssign<T> for RGBA<T>
impl<T> MulAssign<T> for RGBA<T>
px * 1
§fn mul_assign(&mut self, r: T)
fn mul_assign(&mut self, r: T)
Performs the
*=
operation. Read more§impl<ComponentType, AlphaComponentType> Ord for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType, AlphaComponentType> Ord for RGBA<ComponentType, AlphaComponentType>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
§impl<ComponentType, AlphaComponentType> PartialEq for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType, AlphaComponentType> PartialEq for RGBA<ComponentType, AlphaComponentType>
§impl<ComponentType, AlphaComponentType> PartialOrd for RGBA<ComponentType, AlphaComponentType>where
ComponentType: PartialOrd,
AlphaComponentType: PartialOrd,
impl<ComponentType, AlphaComponentType> PartialOrd for RGBA<ComponentType, AlphaComponentType>where
ComponentType: PartialOrd,
AlphaComponentType: PartialOrd,
§fn partial_cmp(
&self,
other: &RGBA<ComponentType, AlphaComponentType>
) -> Option<Ordering>
fn partial_cmp( &self, other: &RGBA<ComponentType, AlphaComponentType> ) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl<T> SubAssign<T> for RGBA<T>
impl<T> SubAssign<T> for RGBA<T>
px - 1
§fn sub_assign(&mut self, r: T)
fn sub_assign(&mut self, r: T)
Performs the
-=
operation. Read more§impl<T, A> SubAssign for RGBA<T, A>
impl<T, A> SubAssign for RGBA<T, A>
px - px
§fn sub_assign(&mut self, other: RGBA<T, A>)
fn sub_assign(&mut self, other: RGBA<T, A>)
Performs the
-=
operation. Read moreimpl<ComponentType, AlphaComponentType> Copy for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType, AlphaComponentType> Eq for RGBA<ComponentType, AlphaComponentType>
impl<T, A> Pod for RGBA<T, A>where
T: Pod,
A: Pod,
impl<ComponentType, AlphaComponentType> StructuralEq for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType, AlphaComponentType> StructuralPartialEq for RGBA<ComponentType, AlphaComponentType>
Auto Trait Implementations§
impl<ComponentType, AlphaComponentType> RefUnwindSafe for RGBA<ComponentType, AlphaComponentType>where
AlphaComponentType: RefUnwindSafe,
ComponentType: RefUnwindSafe,
impl<ComponentType, AlphaComponentType> Send for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType, AlphaComponentType> Sync for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType, AlphaComponentType> Unpin for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType, AlphaComponentType> UnwindSafe for RGBA<ComponentType, AlphaComponentType>where
AlphaComponentType: UnwindSafe,
ComponentType: UnwindSafe,
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
Mutably borrows from an owned value. Read more
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.