Struct colorutils_rs::Rgb
source · pub struct Rgb<T> {
pub r: T,
pub g: T,
pub b: T,
}Expand description
Represents any RGB values, Rgb
Fields§
§r: TRed component
g: TGreen component
b: TBlue component
Implementations§
source§impl Rgb<u8>
impl Rgb<u8>
sourcepub fn to_linear(&self, transfer_function: TransferFunction) -> Rgb<f32>
pub fn to_linear(&self, transfer_function: TransferFunction) -> Rgb<f32>
Converts gamma corrected RGB to linear RGB
§Arguments
transfer_function - Transfer function to convert RGB into linear RGB
sourcepub fn from_linear(
linear_rgb: Rgb<f32>,
transfer_function: TransferFunction,
) -> Rgb<u8>
pub fn from_linear( linear_rgb: Rgb<f32>, transfer_function: TransferFunction, ) -> Rgb<u8>
Converts gamma corrected RGB to linear RGB
§Arguments
transfer_function - Transfer function to convert RGB into linear RGB
sourcepub fn to_jzazbz(&self, transfer_function: TransferFunction) -> Jzazbz
pub fn to_jzazbz(&self, transfer_function: TransferFunction) -> Jzazbz
Converts rgb to Jzazbz Here is luminance always considered 200 nits
§Arguments
display_luminance - display luminance
transfer_function - Transfer function to convert into linear colorspace and backwards
sourcepub fn to_jzazbz_with_luminance(
&self,
display_luminance: f32,
transfer_function: TransferFunction,
) -> Jzazbz
pub fn to_jzazbz_with_luminance( &self, display_luminance: f32, transfer_function: TransferFunction, ) -> Jzazbz
Converts rgb to Jzazbz
§Arguments
display_luminance - display luminance
transfer_function - Transfer function to convert into linear colorspace and backwards
sourcepub fn to_rgb_f32(&self) -> Rgb<f32>
pub fn to_rgb_f32(&self) -> Rgb<f32>
Converts rgb to RGB f32
sourcepub fn to_oklab(&self, transfer_function: TransferFunction) -> Oklab
pub fn to_oklab(&self, transfer_function: TransferFunction) -> Oklab
Converts rgb to Oklab
§Arguments
transfer_function - Transfer function to convert into linear colorspace and backwards
sourcepub fn to_oklch(&self, transfer_function: TransferFunction) -> Oklch
pub fn to_oklch(&self, transfer_function: TransferFunction) -> Oklch
Converts rgb to Oklch
§Arguments
transfer_function - Transfer function to convert into linear colorspace and backwards
sourcepub fn to_sigmoidal(&self) -> Sigmoidal
pub fn to_sigmoidal(&self) -> Sigmoidal
Converts rgb to S-shaped sigmoidized components
sourcepub fn to_lalphabeta(&self, transfer_function: TransferFunction) -> LAlphaBeta
pub fn to_lalphabeta(&self, transfer_function: TransferFunction) -> LAlphaBeta
Converts rgb to lαβ
§Arguments
transfer_function - Transfer function to convert into linear colorspace and backwards
pub fn blend_add(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_hsl_color(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_substract(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_lighten(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_darken(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_color_burn(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_color_dodge(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_screen(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_linear_light(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_vivid_light(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_pin_light(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_hard_mix(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_soft_light(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn blend_exclusion(&self, other: Rgb<u8>) -> Rgb<u8>
pub fn saturation(&self, saturation: f32) -> Rgb<u8>
source§impl Rgb<f32>
impl Rgb<f32>
pub fn apply(&self, gen: fn(_: f32) -> f32) -> Self
pub fn to_u8(&self) -> Rgb<u8>
pub fn clip_color(&self) -> Rgb<f32>
pub fn blend_hsl_color(&self, backdrop: Rgb<f32>) -> Rgb<f32>
sourcepub fn blend_add(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_add(&self, other: Rgb<f32>) -> Rgb<f32>
The output of the ADD operator is the same for both bounded and unbounded source interpretations. Resulting color (xR) - (xaA + xaB)
pub fn blend_substract(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_lighten(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_darken(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_color_burn(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_color_dodge(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_screen(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_linear_light(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_vivid_light(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_pin_light(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_hard_mix(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_reflect(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_difference(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_hard_light(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_soft_light(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn blend_exclusion(&self, other: Rgb<f32>) -> Rgb<f32>
pub fn saturation(&self, saturation: f32) -> Rgb<f32>
pub fn grayscale(&self, grayscale_amount: f32) -> Rgb<f32>
Trait Implementations§
source§impl EuclideanDistance for Rgb<f32>
impl EuclideanDistance for Rgb<f32>
source§impl EuclideanDistance for Rgb<u16>
impl EuclideanDistance for Rgb<u16>
source§impl<T: PartialOrd> PartialOrd for Rgb<T>
impl<T: PartialOrd> PartialOrd for Rgb<T>
impl<T: Copy> Copy for Rgb<T>
impl<T> StructuralPartialEq for Rgb<T>
Auto Trait Implementations§
impl<T> Freeze for Rgb<T>where
T: Freeze,
impl<T> RefUnwindSafe for Rgb<T>where
T: RefUnwindSafe,
impl<T> Send for Rgb<T>where
T: Send,
impl<T> Sync for Rgb<T>where
T: Sync,
impl<T> Unpin for Rgb<T>where
T: Unpin,
impl<T> UnwindSafe for Rgb<T>where
T: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)