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: u8Implementations§
Source§impl RGBA
impl RGBA
pub fn new(red: u8, green: u8, blue: u8, alpha: f32) -> RGBA
pub fn transparent() -> RGBA
pub fn red_f32(self) -> f32
pub fn green_f32(self) -> f32
pub fn blue_f32(self) -> f32
pub fn alpha_f32(self) -> f32
pub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> RGBA
pub fn into_srgb(self) -> SRGB
Sourcepub fn try_from_css_color(color: &CssColor) -> Option<RGBA>
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§
impl Copy for RGBA
impl Eq for RGBA
Source§impl From<RGBA> for SRGBLinear
impl From<RGBA> for SRGBLinear
Source§fn from(c: RGBA) -> SRGBLinear
fn from(c: RGBA) -> SRGBLinear
Converts to this type from the input type.
Source§impl From<SRGBLinear> for RGBA
impl From<SRGBLinear> for RGBA
Source§fn from(c: SRGBLinear) -> RGBA
fn from(c: SRGBLinear) -> RGBA
Converts to this type from the input type.
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> AsCtxPtr for Twhere
T: ?Sized,
impl<T> AsCtxPtr for Twhere
T: ?Sized,
Source§fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
fn as_ctx_ptr(&self) -> *mut Selfwhere
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> 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