#[repr(u32)]pub enum ColorSpaceType {
Invalid = 0,
Srgb = 1,
Rec601Ntsc = 2,
Rec601NtscFullRange = 3,
Rec601Pal = 4,
Rec601PalFullRange = 5,
Rec709 = 6,
Rec2020 = 7,
Rec2100 = 8,
PassThrough = 9,
DoNotCare = 4_294_967_294,
}Expand description
This list has a separate entry for each variant of a color space standard.
For this reason, should we ever add support for the RGB variant of 709, for example, we’d add a separate entry to this list for that variant. Similarly for the RGB variants of 2020 or 2100. Similarly for the YcCbcCrc variant of 2020. Similarly for the ICtCp variant of 2100.
A given ColorSpaceType may permit usage with a PixelFormatType(s) that provides a bits-per-sample that’s compatible with the ColorSpaceType’s official spec. Not all spec-valid combinations are necessarily supported. See ImageFormatIsSupportedColorSpaceForPixelFormat() for the best-case degree of support, but a “true” from that function doesn’t guarantee that any given combination of participants will all support the desired combination of ColorSpaceType and PixelFormatType.
The sysmem service helps find a mutually supported combination and allocate suitable buffers.
A ColorSpaceType’s spec is not implicitly extended to support outside-the-standard bits-per-sample (R, G, B, or Y sample). For example, for 2020 and 2100, 8 bits-per-Y-sample is not supported (by sysmem), because 8 bits-per-Y-sample is not in the spec for 2020 or 2100. A sysmem participant that attempts to advertise support for a PixelFormat + ColorSpace that’s non-standard will cause sysmem to reject the combo and fail to allocate (intentionally, to strongly discourage specifying insufficiently-defined combos).
This type is deprecated for new code, but is still used by some camera code.
Variants§
Invalid = 0
Not a valid color space type.
Srgb = 1
sRGB
Rec601Ntsc = 2
601 NTSC (“525 line”) YCbCr primaries, narrow
Rec601NtscFullRange = 3
601 NTSC (“525 line”) YCbCr primaries, wide
Rec601Pal = 4
601 PAL (“625 line”) YCbCr primaries, narrow
Rec601PalFullRange = 5
601 PAL (“625 line”) YCbCr primaries, wide
Rec709 = 6
709 YCbCr (not RGB)
Rec2020 = 7
2020 YCbCr (not RGB, not YcCbcCrc)
Rec2100 = 8
2100 YCbCr (not RGB, not ICtCp)
PassThrough = 9
Either the pixel format doesn’t represent a color, or it’s in an application-specific colorspace that isn’t describable by another entry in this enum.
DoNotCare = 4_294_967_294
The sysmem client is explicitly indicating that the sysmem client does not care which color space is chosen / used.
Implementations§
Source§impl ColorSpaceType
impl ColorSpaceType
pub fn from_primitive(prim: u32) -> Option<ColorSpaceType>
pub const fn into_primitive(self) -> u32
Trait Implementations§
Source§impl Clone for ColorSpaceType
impl Clone for ColorSpaceType
Source§fn clone(&self) -> ColorSpaceType
fn clone(&self) -> ColorSpaceType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ColorSpaceType
impl Debug for ColorSpaceType
Source§impl<D> Decode<ColorSpaceType, D> for ColorSpaceTypewhere
D: ResourceDialect,
impl<D> Decode<ColorSpaceType, D> for ColorSpaceTypewhere
D: ResourceDialect,
Source§fn new_empty() -> ColorSpaceType
fn new_empty() -> ColorSpaceType
Self. The specific value does not matter,
since it will be overwritten by decode.Source§impl<D> Encode<ColorSpaceType, D> for ColorSpaceTypewhere
D: ResourceDialect,
impl<D> Encode<ColorSpaceType, D> for ColorSpaceTypewhere
D: ResourceDialect,
Source§impl Hash for ColorSpaceType
impl Hash for ColorSpaceType
Source§impl Ord for ColorSpaceType
impl Ord for ColorSpaceType
Source§fn cmp(&self, other: &ColorSpaceType) -> Ordering
fn cmp(&self, other: &ColorSpaceType) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ColorSpaceType
impl PartialEq for ColorSpaceType
Source§impl PartialOrd for ColorSpaceType
impl PartialOrd for ColorSpaceType
Source§impl TypeMarker for ColorSpaceType
impl TypeMarker for ColorSpaceType
Source§type Owned = ColorSpaceType
type Owned = ColorSpaceType
Source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
Source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align.Source§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned to a single memcpy. Read moreSource§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned to a single memcpy.Source§impl ValueTypeMarker for ColorSpaceType
impl ValueTypeMarker for ColorSpaceType
Source§type Borrowed<'a> = ColorSpaceType
type Borrowed<'a> = ColorSpaceType
Encode<Self>
type cheaply obtainable from &Self::Owned. There are three cases: Read moreSource§fn borrow(
value: &<ColorSpaceType as TypeMarker>::Owned,
) -> <ColorSpaceType as ValueTypeMarker>::Borrowed<'_>
fn borrow( value: &<ColorSpaceType as TypeMarker>::Owned, ) -> <ColorSpaceType as ValueTypeMarker>::Borrowed<'_>
&Self::Owned to Self::Borrowed.