Struct PremulRgba8
#[repr(C)]pub struct PremulRgba8 {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}Expand description
A packed representation of pre-multiplied 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 PremulColor::to_rgba8.
For a non-pre-multiplied packed representation, see Rgba8.
Fields§
§r: u8Red component.
g: u8Green component.
b: u8Blue component.
a: u8Alpha component.
Implementations§
§impl PremulRgba8
impl PremulRgba8
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]) -> PremulRgba8
pub const fn from_u8_array(_: [u8; 4]) -> PremulRgba8
Convert the [u8; 4] byte array into a PremulRgba8 color.
The color values must be given in the order [r, g, b, a].
pub const fn to_u32(self) -> u32
pub const fn to_u32(self) -> u32
Returns the color as a little-endian packed value, with r the least significant byte and
a the most significant.
pub const fn from_u32(packed_bytes: u32) -> PremulRgba8
pub const fn from_u32(packed_bytes: u32) -> PremulRgba8
Interpret the little-endian packed value as a color, with r the least significant byte
and a the most significant.
Trait Implementations§
§impl Clone for PremulRgba8
impl Clone for PremulRgba8
§fn clone(&self) -> PremulRgba8
fn clone(&self) -> PremulRgba8
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for PremulRgba8
impl Debug for PremulRgba8
§impl From<PremulRgba8> for PremulColor<Srgb>
impl From<PremulRgba8> for PremulColor<Srgb>
§fn from(value: PremulRgba8) -> PremulColor<Srgb>
fn from(value: PremulRgba8) -> PremulColor<Srgb>
§impl PartialEq for PremulRgba8
impl PartialEq for PremulRgba8
impl Copy for PremulRgba8
impl Eq for PremulRgba8
impl StructuralPartialEq for PremulRgba8
Auto Trait Implementations§
impl Freeze for PremulRgba8
impl RefUnwindSafe for PremulRgba8
impl Send for PremulRgba8
impl Sync for PremulRgba8
impl Unpin for PremulRgba8
impl UnwindSafe for PremulRgba8
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
§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)
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