Struct Rgba8
#[repr(C)]pub struct Rgba8 {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}Expand description
A packed representation of sRGB colors.
Encoding sRGB with 8 bits per component is extremely common, as it is efficient and convenient, even if limited in accuracy and gamut.
This is not meant to be a general purpose color type and is
intended for use with AlphaColor::to_rgba8 and OpaqueColor::to_rgba8.
For a pre-multiplied packed representation, see PremulRgba8.
Fields§
§r: u8Red component.
g: u8Green component.
b: u8Blue component.
a: u8Alpha component.
Alpha is interpreted as separated alpha.
Implementations§
§impl Rgba8
impl Rgba8
pub const fn to_u8_array(self) -> [u8; 4]
pub const fn to_u8_array(self) -> [u8; 4]
Returns the color as a [u8; 4].
The color values will be in the order [r, g, b, a].
pub const fn from_u8_array(_: [u8; 4]) -> Rgba8
pub const fn from_u8_array(_: [u8; 4]) -> Rgba8
Convert the [u8; 4] byte array into an Rgba8 color.
The color values must be given in the order [r, g, b, a].
Trait Implementations§
§impl From<Rgba8> for AlphaColor<Srgb>
impl From<Rgba8> for AlphaColor<Srgb>
§fn from(value: Rgba8) -> AlphaColor<Srgb>
fn from(value: Rgba8) -> AlphaColor<Srgb>
Converts to this type from the input type.
impl Copy for Rgba8
impl Eq for Rgba8
impl StructuralPartialEq for Rgba8
Auto Trait Implementations§
impl Freeze for Rgba8
impl RefUnwindSafe for Rgba8
impl Send for Rgba8
impl Sync for Rgba8
impl Unpin for Rgba8
impl UnwindSafe for Rgba8
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
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>
Converts
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>
Converts
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 moreSource§impl<T> StaticAnim for Twhere
T: StaticAnimRequirement + 'static,
impl<T> StaticAnim for Twhere
T: StaticAnimRequirement + 'static,
Source§fn show(&self) -> AnimationCell<T>
fn show(&self) -> AnimationCell<T>
Show the item
Source§fn hide(&self) -> AnimationCell<T>
fn hide(&self) -> AnimationCell<T>
Hide the item