pub struct LinearSrgb {
pub red: f32,
pub green: f32,
pub blue: f32,
}
Expand description
§Linear RGB Color Space
LinearSrgb
represents colors in a linear RGB color space, where values are directly
proportional to light intensity (not gamma-encoded).
§Color Space Properties
- No Gamma Encoding: Values are linearly proportional to light intensity
- RGB Primaries: Same as sRGB (IEC 61966-2-1)
- White Point: D65 (6500K)
Mathematical operations on linear RGB values (like averaging or interpolation) will produce physically correct results, unlike operations on gamma-encoded sRGB values.
Fields§
§red: f32
Red component (0.0 to 1.0)
green: f32
Green component (0.0 to 1.0)
blue: f32
Blue component (0.0 to 1.0)
Implementations§
Source§impl LinearSrgb
impl LinearSrgb
Sourcepub fn to_srgb(self) -> Srgb
pub fn to_srgb(self) -> Srgb
Converts from linear RGB to sRGB color space
This applies gamma encoding to make the color values perceptually uniform.
Sourcepub fn to_gamma_srgb(self, gamma: f32) -> GammaSrgb
pub fn to_gamma_srgb(self, gamma: f32) -> GammaSrgb
Converts to gamma-encoded RGB using the specified gamma value
Sourcepub fn to_led<C>(
self,
channels: LedChannels,
brightness: f32,
correction: ColorCorrection,
) -> LedColor<C>where
C: Component,
pub fn to_led<C>(
self,
channels: LedChannels,
brightness: f32,
correction: ColorCorrection,
) -> LedColor<C>where
C: Component,
Trait Implementations§
Source§impl Clone for LinearSrgb
impl Clone for LinearSrgb
Source§fn clone(&self) -> LinearSrgb
fn clone(&self) -> LinearSrgb
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for LinearSrgb
impl Debug for LinearSrgb
Source§impl FromColor<GammaSrgb> for LinearSrgb
impl FromColor<GammaSrgb> for LinearSrgb
Source§fn from_color(color: GammaSrgb) -> LinearSrgb
fn from_color(color: GammaSrgb) -> LinearSrgb
Converts from the source color type
Source§impl<M> FromColor<Hsv<M>> for LinearSrgbwhere
M: HsvHueMap,
impl<M> FromColor<Hsv<M>> for LinearSrgbwhere
M: HsvHueMap,
Source§fn from_color(color: Hsv<M>) -> LinearSrgb
fn from_color(color: Hsv<M>) -> LinearSrgb
Converts from the source color type
Source§impl FromColor<Lms> for LinearSrgb
impl FromColor<Lms> for LinearSrgb
Source§fn from_color(color: Lms) -> LinearSrgb
fn from_color(color: Lms) -> LinearSrgb
Converts from the source color type
Source§impl FromColor<Okhsl> for LinearSrgb
impl FromColor<Okhsl> for LinearSrgb
Source§fn from_color(color: Okhsl) -> LinearSrgb
fn from_color(color: Okhsl) -> LinearSrgb
Converts from the source color type
Source§impl FromColor<Okhsv> for LinearSrgb
impl FromColor<Okhsv> for LinearSrgb
Source§fn from_color(color: Okhsv) -> LinearSrgb
fn from_color(color: Okhsv) -> LinearSrgb
Converts from the source color type
Source§impl FromColor<Oklab> for LinearSrgb
impl FromColor<Oklab> for LinearSrgb
Source§fn from_color(color: Oklab) -> LinearSrgb
fn from_color(color: Oklab) -> LinearSrgb
Converts from the source color type
Source§impl FromColor<Srgb> for LinearSrgb
impl FromColor<Srgb> for LinearSrgb
Source§fn from_color(color: Srgb) -> LinearSrgb
fn from_color(color: Srgb) -> LinearSrgb
Converts from the source color type
Source§impl FromColor<Xyz> for LinearSrgb
impl FromColor<Xyz> for LinearSrgb
Source§fn from_color(color: Xyz) -> LinearSrgb
fn from_color(color: Xyz) -> LinearSrgb
Converts from the source color type
Source§impl PartialEq for LinearSrgb
impl PartialEq for LinearSrgb
impl Copy for LinearSrgb
impl StructuralPartialEq for LinearSrgb
Auto Trait Implementations§
impl Freeze for LinearSrgb
impl RefUnwindSafe for LinearSrgb
impl Send for LinearSrgb
impl Sync for LinearSrgb
impl Unpin for LinearSrgb
impl UnwindSafe for LinearSrgb
Blanket Implementations§
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
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>,
Casts the value.
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>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromColor<T> for T
impl<T> FromColor<T> for T
Source§fn from_color(color: T) -> T
fn from_color(color: T) -> T
Converts from the source color type
Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Converts into the target color type
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> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.