pub struct Srgba8 {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}Expand description
Non-linear sRGB+A color representation using 4 × u8 components.
Better suited for saving to the final graphics buffer.
Fields§
§r: u8Gamma encoded red luminosity.
g: u8Gamma encoded green luminosity.
b: u8Gamma encoded blue luminosity.
a: u8Linear alpha channel.
Implementations§
Source§impl Srgba8
impl Srgba8
pub fn to_notcurses(&self) -> Rgba
notcurses only.Source§impl Srgba8
§Direct conversions
impl Srgba8
§Direct conversions
Sourcepub fn from_array(c: [u8; 4]) -> Srgba8
pub fn from_array(c: [u8; 4]) -> Srgba8
Direct conversion from an array.
Sourcepub fn from_srgb8(c: Srgb8, alpha: u8) -> Srgba8
pub fn from_srgb8(c: Srgb8, alpha: u8) -> Srgba8
Direct conversion from Srgb8.
Adds the alpha channel.
Sourcepub fn from_srgb32(c: Srgb32, alpha: u8) -> Srgba8
pub fn from_srgb32(c: Srgb32, alpha: u8) -> Srgba8
Direct conversion from Srgb32.
Adds the alpha channel.
Sourcepub fn from_srgba32(c: Srgba32) -> Srgba8
pub fn from_srgba32(c: Srgba32) -> Srgba8
Direct conversion from Srgba32.
Sourcepub fn to_srgba32(&self) -> Srgba32
pub fn to_srgba32(&self) -> Srgba32
Direct conversion to Srgba32.
Source§impl Srgba8
§Indirect conversions
impl Srgba8
§Indirect conversions
Sourcepub fn from_linear_srgb32(c: LinearSrgb32, alpha: u8) -> Srgba8
Available on crate features std or no_std only.
pub fn from_linear_srgb32(c: LinearSrgb32, alpha: u8) -> Srgba8
std or no_std only.Indirect conversion from Srgb32.
Adds the alpha channel.
Sourcepub fn to_linear_srgb32(&self) -> LinearSrgb32
Available on crate features std or no_std only.
pub fn to_linear_srgb32(&self) -> LinearSrgb32
std or no_std only.Indirect conversion to LinearSrgb32.
Loses the alpha channel.
Sourcepub fn from_linear_srgba32(c: LinearSrgba32) -> Srgba8
Available on crate features std or no_std only.
pub fn from_linear_srgba32(c: LinearSrgba32) -> Srgba8
std or no_std only.Indirect conversion from LinearSrgba32.
Sourcepub fn to_linear_srgba32(&self) -> LinearSrgba32
Available on crate features std or no_std only.
pub fn to_linear_srgba32(&self) -> LinearSrgba32
std or no_std only.Indirect conversion to LinearSrgba32.
Sourcepub fn from_oklab32(c: Oklab32, alpha: u8) -> Srgba8
Available on crate features std or no_std only.
pub fn from_oklab32(c: Oklab32, alpha: u8) -> Srgba8
std or no_std only.Indirect conversion from Oklab32.
Adds the alpha channel.
Sourcepub fn to_oklab32(&self) -> Oklab32
Available on crate features std or no_std only.
pub fn to_oklab32(&self) -> Oklab32
std or no_std only.Indirect conversion to Oklab32.
Loses the alpha channel.
Sourcepub fn from_oklch32(c: Oklch32, alpha: u8) -> Srgba8
Available on crate features std or no_std only.
pub fn from_oklch32(c: Oklch32, alpha: u8) -> Srgba8
std or no_std only.Indirect conversion from Oklch32.
Adds the alpha channel.
Sourcepub fn to_oklch32(&self) -> Oklch32
Available on crate features std or no_std only.
pub fn to_oklch32(&self) -> Oklch32
std or no_std only.Indirect conversion to Oklch32.
Loses the alpha channel.
Trait Implementations§
Source§impl Color for Srgba8
Available on crate features std or no_std only.
impl Color for Srgba8
std or no_std only.Source§fn color_green(&self) -> Self::Inner
fn color_green(&self) -> Self::Inner
Returns the gamma corrected green luminosity.
Source§fn color_blue(&self) -> Self::Inner
fn color_blue(&self) -> Self::Inner
Returns the gamma corrected blue luminosity.
Source§fn color_alpha(&self) -> Self::Inner
fn color_alpha(&self) -> Self::Inner
Returns the linear alpha.
Source§fn color_to_srgba8(&self) -> Srgba8
fn color_to_srgba8(&self) -> Srgba8
no-op.
Source§fn color_to_array3(&self) -> [Self::Inner; 3]
fn color_to_array3(&self) -> [Self::Inner; 3]
Source§fn color_luminosity(&self) -> Self::Inner
fn color_luminosity(&self) -> Self::Inner
Source§fn color_to_srgb8(&self) -> Srgb8
fn color_to_srgb8(&self) -> Srgb8
Srgb8.Source§fn color_to_srgb32(&self) -> Srgb32
fn color_to_srgb32(&self) -> Srgb32
Srgb32.Source§fn color_to_srgba32(&self) -> Srgba32
fn color_to_srgba32(&self) -> Srgba32
Srgba32.Source§fn color_to_linear_srgb32(&self) -> LinearSrgb32
fn color_to_linear_srgb32(&self) -> LinearSrgb32
LinearSrgb32.Source§fn color_to_linear_srgba32(&self) -> LinearSrgba32
fn color_to_linear_srgba32(&self) -> LinearSrgba32
LinearSrgba32.Source§fn color_to_oklab32(&self) -> Oklab32
fn color_to_oklab32(&self) -> Oklab32
Oklab32.Source§fn color_to_oklch32(&self) -> Oklch32
fn color_to_oklch32(&self) -> Oklch32
Oklch32.Source§impl From<ColorU8> for Srgba8
Available on crate feature tiny-skia and (crate features std or no_std) only.
impl From<ColorU8> for Srgba8
tiny-skia and (crate features std or no_std) only.Source§impl From<LinearSrgb32> for Srgba8
Available on crate features std or no_std only.
impl From<LinearSrgb32> for Srgba8
std or no_std only.Source§fn from(c: LinearSrgb32) -> Srgba8
fn from(c: LinearSrgb32) -> Srgba8
Automatically adds alpha at max opacity.
Source§impl From<LinearSrgba32> for Srgba8
Available on crate features std or no_std only.
impl From<LinearSrgba32> for Srgba8
std or no_std only.Source§fn from(c: LinearSrgba32) -> Srgba8
fn from(c: LinearSrgba32) -> Srgba8
Source§impl From<PremultipliedColorU8> for Srgba8
Available on crate feature tiny-skia and (crate features std or no_std) only.
impl From<PremultipliedColorU8> for Srgba8
tiny-skia and (crate features std or no_std) only.Source§impl From<Rgba<u8>> for Srgba8
Available on crate feature rgb only.Convert rust-rgb’s RGBA<u8> type into Srgba8.
impl From<Rgba<u8>> for Srgba8
rgb only.Convert rust-rgb’s RGBA<u8> type into Srgba8.
Source§impl From<Srgba8> for ColorU8
Available on crate feature tiny-skia and (crate features std or no_std) only.
impl From<Srgba8> for ColorU8
tiny-skia and (crate features std or no_std) only.Source§impl From<Srgba8> for PremultipliedColorU8
Available on crate feature tiny-skia and (crate features std or no_std) only.
impl From<Srgba8> for PremultipliedColorU8
tiny-skia and (crate features std or no_std) only.Source§impl From<Srgba8> for RGBA<u8>
Available on crate feature rgb only.Convert Srgba8 into rust-rgb’s RGBA<u8> type.
impl From<Srgba8> for RGBA<u8>
rgb only.Convert Srgba8 into rust-rgb’s RGBA<u8> type.
Source§impl Ord for Srgba8
impl Ord for Srgba8
Source§impl PartialOrd for Srgba8
impl PartialOrd for Srgba8
impl Copy for Srgba8
impl Eq for Srgba8
impl StructuralPartialEq for Srgba8
Auto Trait Implementations§
impl Freeze for Srgba8
impl RefUnwindSafe for Srgba8
impl Send for Srgba8
impl Sync for Srgba8
impl Unpin for Srgba8
impl UnwindSafe for Srgba8
Blanket Implementations§
Source§impl<T> Also for T
impl<T> Also for T
Source§impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.