Skip to main content

RGBA

Struct RGBA 

Source
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§green: u8§blue: u8§alpha: u8

Implementations§

Source§

impl RGBA

Source

pub fn new(red: u8, green: u8, blue: u8, alpha: f32) -> RGBA

Source

pub fn transparent() -> RGBA

Source

pub fn red_f32(self) -> f32

Source

pub fn green_f32(self) -> f32

Source

pub fn blue_f32(self) -> f32

Source

pub fn alpha_f32(self) -> f32

Source

pub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> RGBA

Source

pub fn into_srgb(self) -> SRGB

Source

pub fn into_hsl(self) -> HSL

Zig: rgba.into(.HSL) — routes RGBA → SRGB → HSL.

Source

pub fn into_lab(self) -> LAB

Zig: rgba.into(.LAB) — routes RGBA → SRGB → LAB.

Source

pub fn try_from_css_color(color: &CssColor) -> Option<RGBA>

Convert any CssColor into RGBA by routing through SRGB. Zig: ColorspaceConversions(@This()).tryFromCssColor.

Trait Implementations§

Source§

impl Clone for RGBA

Source§

fn clone(&self) -> RGBA

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RGBA

Source§

impl Debug for RGBA

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RGBA

Source§

impl From<A98> for RGBA

Source§

fn from(c: A98) -> RGBA

Converts to this type from the input type.
Source§

impl From<HSL> for RGBA

Source§

fn from(c: HSL) -> RGBA

Converts to this type from the input type.
Source§

impl From<HWB> for RGBA

Source§

fn from(c: HWB) -> RGBA

Converts to this type from the input type.
Source§

impl From<LAB> for RGBA

Source§

fn from(c: LAB) -> RGBA

Converts to this type from the input type.
Source§

impl From<LCH> for RGBA

Source§

fn from(c: LCH) -> RGBA

Converts to this type from the input type.
Source§

impl From<OKLAB> for RGBA

Source§

fn from(c: OKLAB) -> RGBA

Converts to this type from the input type.
Source§

impl From<OKLCH> for RGBA

Source§

fn from(c: OKLCH) -> RGBA

Converts to this type from the input type.
Source§

impl From<P3> for RGBA

Source§

fn from(c: P3) -> RGBA

Converts to this type from the input type.
Source§

impl From<ProPhoto> for RGBA

Source§

fn from(c: ProPhoto) -> RGBA

Converts to this type from the input type.
Source§

impl From<RGBA> for SRGB

Source§

fn from(rgb: RGBA) -> SRGB

Converts to this type from the input type.
Source§

impl From<RGBA> for LAB

Source§

fn from(c: RGBA) -> LAB

Converts to this type from the input type.
Source§

impl From<RGBA> for LCH

Source§

fn from(c: RGBA) -> LCH

Converts to this type from the input type.
Source§

impl From<RGBA> for OKLAB

Source§

fn from(c: RGBA) -> OKLAB

Converts to this type from the input type.
Source§

impl From<RGBA> for OKLCH

Source§

fn from(c: RGBA) -> OKLCH

Converts to this type from the input type.
Source§

impl From<RGBA> for P3

Source§

fn from(c: RGBA) -> P3

Converts to this type from the input type.
Source§

impl From<RGBA> for SRGBLinear

Source§

fn from(c: RGBA) -> SRGBLinear

Converts to this type from the input type.
Source§

impl From<RGBA> for A98

Source§

fn from(c: RGBA) -> A98

Converts to this type from the input type.
Source§

impl From<RGBA> for ProPhoto

Source§

fn from(c: RGBA) -> ProPhoto

Converts to this type from the input type.
Source§

impl From<RGBA> for XYZd50

Source§

fn from(c: RGBA) -> XYZd50

Converts to this type from the input type.
Source§

impl From<RGBA> for XYZd65

Source§

fn from(c: RGBA) -> XYZd65

Converts to this type from the input type.
Source§

impl From<RGBA> for Rec2020

Source§

fn from(c: RGBA) -> Rec2020

Converts to this type from the input type.
Source§

impl From<RGBA> for HSL

Source§

fn from(c: RGBA) -> HSL

Converts to this type from the input type.
Source§

impl From<RGBA> for HWB

Source§

fn from(c: RGBA) -> HWB

Converts to this type from the input type.
Source§

impl From<Rec2020> for RGBA

Source§

fn from(c: Rec2020) -> RGBA

Converts to this type from the input type.
Source§

impl From<SRGB> for RGBA

Source§

fn from(rgb: SRGB) -> RGBA

Converts to this type from the input type.
Source§

impl From<SRGBLinear> for RGBA

Source§

fn from(c: SRGBLinear) -> RGBA

Converts to this type from the input type.
Source§

impl From<XYZd50> for RGBA

Source§

fn from(c: XYZd50) -> RGBA

Converts to this type from the input type.
Source§

impl From<XYZd65> for RGBA

Source§

fn from(c: XYZd65) -> RGBA

Converts to this type from the input type.
Source§

impl PartialEq for RGBA

Source§

fn eq(&self, other: &RGBA) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq 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 UnsafeUnpin for RGBA

§

impl UnwindSafe for RGBA

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsCtxPtr for T
where T: ?Sized,

Source§

fn as_ctx_ptr(&self) -> *mut Self
where Self: Sized,

self’s address as *mut Self for deferred-task / scopeguard / ref_guard ctx slots. The closures/trampolines deref it as shared (&*p) — every method they reach is &self post-R-2, so no write provenance is required; the *mut spelling is purely to match the existing DerefOnDrop / HasAutoFlush / RefCount ABI.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAnyColorspace for T

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V