#[repr(u32)]
pub enum Spaces {
Show 36 variants EncodedSrgb, LinearSrgb, EncodedRec709, Rec709, GenericColor3, GenericColor1, Luminance, Luma, AcesCg, Aces2065, AcesCc, AcesCct, DisplayP3, EncodedDisplayP3, DciP3, DciXYZPrime, Bt2020, EncodedBt2020, Bt2100, EncodedBt2100PQ, EncodedBt2100HLG, ICtCpPQ, ICtCpHLG, CieXYZ, CieLab, CieLCh, Oklab, Oklch, Hsl, Hsv, YCbCr, YPrimeCbCr, YPbPr, YPrimePbPr, Yuv, YCxCz,
}
Expand description

An enum with a variant for each of the color spaces supported by the library. Useful for tracking as metadata in something like an image type, and for runtime-determined color types.

Variants

EncodedSrgb

A color in the encoded sRGB color space.

This color space uses the sRGB/Rec.709 primaries, D65 white point, and sRGB transfer functions. The encoded version is nonlinear, with the sRGB OETF, aka “gamma compensation”, applied.

LinearSrgb

A color in the linear (decoded) sRGB color space.

This color space uses the sRGB/Rec.709 primaries, D65 white point, and sRGB transfer functions. This version is linear, with the sRGB EOTF, aka “inverse gamma compensation”, applied in order to decode it from EncodedSrgb

EncodedRec709

A color in the encoded Rec.709/BT.709 color space.

This color space uses the BT.709 primaries, D65 white point, and BT.601 (reused in BT.709) transfer function. The encoded version is nonlinear, with the BT.601 OETF applied.

Rec709

A color in the Rec.709/BT.709 color space.

This color space uses the BT.709 primaries, D65 white point, and BT.601 (reused in BT.709) transfer function. This version is linear, without the BT.601 OETF applied.

GenericColor3

A color in a generic color space that can be represented by 3 components. The user is responsible for ensuring that the correct color space is respected.

GenericColor1

A color in a generic color space that can be represented by 1 component. The user is responsible for ensuring that the correct color space is respected.

Luminance

A single-channel CIE luminance.

Luma

A single-channel CIE luma (non-linear transform from luminance).

AcesCg

A color in the ACEScg color space.

This color space uses the ACES AP1 primaries and D60 white point.

Aces2065

A color in the ACES 2065-1 color space.

This color space uses the ACES AP0 primaries and D60 white point.

AcesCc

A color in the ACEScc color space.

This color space uses the ACES AP1 primaries and D60 white point and a pure logarithmic transfer function.

AcesCct

A color in the ACEScct color space.

This color space uses the ACES AP1 primaries and D60 white point and a logarithmic transfer function with a toe such that values are able to go negative.

DisplayP3

A color in the Display P3 (aka P3 D65) color space.

This color space uses the P3 primaries and D65 white point and sRGB transfer functions. This version is linear, without the sRGB OETF applied.

EncodedDisplayP3

A color in the Display P3 (aka P3 D65) color space.

This color space uses the P3 primaries and D65 white point and sRGB transfer functions. This encoded version is nonlinear, with the sRGB OETF applied.

DciP3

A color in the DCI-P3 (aka P3 DCI and P3 D60) color space.

If you are looking for the P3 which is used on new Apple displays, see DisplayP3 instead.

This color space uses the P3 primaries and D60 white point.

DciXYZPrime

A color in the X’Y’Z’ color space, a DCI specification used for digital cinema mastering.

This color space uses the CIE XYZ primaries, with special DCI white point and pure 2.6 gamma encoding.

Bt2020

A color in the BT.2020 color space.

This color space uses the BT.2020 primaries and D65 white point.

EncodedBt2020

A color in the encoded BT.2020 color space.

This color space uses the BT.2020 primaries and D65 white point and the BT.2020 transfer functions (equivalent to BT.601 transfer functions but with higher precision). This encoded version is nonlinear, with the BT.2020/BT.601 OETF applied.

Bt2100

A color in the BT.2100 color space.

This color space uses the BT.2020 primaries and D65 white point.

EncodedBt2100PQ

A color in the encoded BT.2100 color space with PQ (Perceptual Quantizer) transfer function.

This color space uses the BT.2020 primaries and D65 white point and the ST 2084/“PQ” transfer function. It is nonlinear.

EncodedBt2100HLG

A color in the encoded BT.2100 color space with HLG (Hybrid Log-Gamma) transfer function.

This color space uses the BT.2020 primaries and D65 white point and the HLG transfer function. It is nonlinear.

ICtCpPQ

A color in the ICtCp color space with PQ (Perceptual Quantizer) nonlinearity.

This color space is based on the BT.2020 primaries and D65 white point, but is not an RGB color space. Instead it is a roughly perceptual color space meant to more efficiently encode HDR content.

ICtCpHLG

A color in the ICtCp color space with HLG (Hybrid Log-Gamma) nonlinearity.

This color space is based on the BT.2020 primaries and D65 white point, but is not an RGB color space. Instead it is a roughly perceptual color space meant to more efficiently encode HDR content.

CieXYZ

A color in the CIE XYZ color space.

This color space uses the CIE XYZ primaries and D65 white point.

CieLab

A color in the CIE L*a*b* color space.

CieLCh

A color in the CIE L*C*h° color space.

Oklab

A color in the Oklab color space.

Oklch

A color in the Oklch color space (a transformation from Oklab to LCh° coordinates).

Hsl

A color in the HSL color space.

Since HSL is a relative color space, it is required to know the RGB space which it was transformed from. We define this as the linear sRGB space, as that is the most common case.

Hsv

A color in the HSV color space.

Since HSV is a relative color space, it is required to know the RGB space which it was transformed from. We define this as the linear sRGB space, as that is the most common case.

YCbCr

A color in the YCbCr color space. See discussion of the difference between YCbCr, YUV, and YPbPr in YCbCr Wikipedia article

Since YCbCr is a relative color space, it is required to know the RGB space which it was transformed from. We define this as being converted from the LinearSrgb color space.

YPrimeCbCr

A color in the Y’CbCr color space. See discussion of the difference between YCbCr, Y’CbCr, YUV, YPbPr, and Y’PbPr in the YCbCr Wikipedia article

Since Y’CbCr is a relative color space, it is required to know the RGB space which it was transformed from. We define this as being converted from the EncodedSrgb color space.

YPbPr

A color in the YPbPr color space. See discussion of the difference between YCbCr, YUV, YPbPr, and Y’PbPr in the YCbCr Wikipedia article

Since YPbPr is a relative color space, it is required to know the RGB space which it was transformed from. We define this as being converted from the LinearSrgb color space.

YPrimePbPr

A color in the Y’PbPr color space. See discussion of the difference between YCbCr, YUV, YPbPr, and Y’PbPr in the YCbCr Wikipedia article

Since Y’PbPr is a relative color space, it is required to know the RGB space which it was transformed from. We define this as being converted from the EncodedSrgb color space.

Yuv

A color in the YUV color space. See discussion of the difference between YCbCr, YUV, and YPbPr in YCbCr Wikipedia article

YCxCz

A color in the YCxCz (also called YyCxCz) color space, originally defined in “Optimized universal color palette design for error diffusion” by B. W. Kolpatzik and C. A. Bouman. Can be thought of as a “linear CIE Lab”.

Implementations

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.