pub struct LinearSrgb;
Expand description

The linear form of the sRGB color encoding standard.

This is a moderately rare way to specify color values.

If you have three f32s which are not directly related to the u8 form, or you otherwise know should be “linear rgb” values, then this is the encoding you have. If you instead have four values with an alpha component where the alpha component varies independently of the color components, you have LinearSrgbA values. If you have four values with an alpha component and the rgb components are modified directly when the alpha component changes as well, you have LinearSrgbAPremultiplied values.

Trait Implementations§

source§

impl ColorEncoding for LinearSrgb

§

type Repr = Vec3

The raw data representation used by this encoding. Read more
§

type ComponentStruct = Rgb<f32>

The ‘bag of components’ this color encoding uses. Read more
§

type LinearSpace = Srgb

The LinearColorSpace used by this encoding. Read more
source§

const NAME: &'static str = "LinearSrgb"

Used in Debug and Display implementations.
source§

fn src_transform_raw(repr: Self::Repr) -> (Vec3, f32)

Convert from Self::Repr to a glam::Vec3 in the Self::LinearSpace color space and a separate (not pre-multiplied) alpha component. If this encoding does not have alpha, return 1.0.
source§

fn dst_transform_raw(raw: Vec3, _: f32) -> Self::Repr

Convert from a glam::Vec3 in Self::LinearSpace and separate alpha component to a Self::Repr fully encoded in Self’s color encoding. If this encoding does not have alpha, you can disregard it.
source§

impl ConvertFrom<LinearSrgb> for LinearSrgbA

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<LinearSrgb> for LinearSrgbAPremultiplied

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<LinearSrgb> for Oklab

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<LinearSrgb> for SrgbAF32

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<LinearSrgb> for SrgbAU8

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<LinearSrgb> for SrgbAU8Premultiplied

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<LinearSrgb> for SrgbF32

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<LinearSrgb> for SrgbU8

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<LinearSrgbA> for LinearSrgb

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<LinearSrgbAPremultiplied> for LinearSrgb

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<Oklab> for LinearSrgb

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<SrgbAF32> for LinearSrgb

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<SrgbAU8> for LinearSrgb

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<SrgbAU8Premultiplied> for LinearSrgb

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<SrgbF32> for LinearSrgb

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl ConvertFrom<SrgbU8> for LinearSrgb

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl WorkingEncoding for LinearSrgb

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<E> ConvertFrom<E> for Ewhere E: ColorEncoding, <E as ColorEncoding>::LinearSpace: LinearConvertFromRaw<<E as ColorEncoding>::LinearSpace>,

source§

fn map_src(_src: &mut SrcEnc::Repr)

If required or desired, perform a mapping of some kind to the input before it undergoes its source transform. This may be desirable to perform some form of gamut mapping if the src encoding has a larger size of representable colors than the dst encoding.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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<E> LinearInterpolate for Ewhere <E as ColorEncoding>::Repr: Add<<E as ColorEncoding>::Repr, Output = <E as ColorEncoding>::Repr> + Sub<<E as ColorEncoding>::Repr, Output = <E as ColorEncoding>::Repr> + Mul<f32, Output = <E as ColorEncoding>::Repr>, E: ColorEncoding + WorkingEncoding,

source§

fn lerp(from: Color<E>, to: Color<E>, factor: f32) -> Color<E>

source§

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

§

type Error = Infallible

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 Twhere U: TryFrom<T>,

§

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.