Skip to main content

SurfaceFormatKind

Enum SurfaceFormatKind 

Source
pub enum SurfaceFormatKind {
Show 27 variants Bgra8(SurfaceFormat), Rgba8(SurfaceFormat), Nv12(SurfaceFormat), Nv21(SurfaceFormat), I420(SurfaceFormat), Yv12(SurfaceFormat), Nv16(SurfaceFormat), Nv61(SurfaceFormat), Yu16(SurfaceFormat), Yv16(SurfaceFormat), Nv24(SurfaceFormat), Yuv444(SurfaceFormat), Mono8(SurfaceFormat), P010(SurfaceFormat), P012(SurfaceFormat), P016(SurfaceFormat), I010(SurfaceFormat), I012(SurfaceFormat), I016(SurfaceFormat), P210(SurfaceFormat), P212(SurfaceFormat), P216(SurfaceFormat), P410(SurfaceFormat), P412(SurfaceFormat), P416(SurfaceFormat), Q410(SurfaceFormat), Q416(SurfaceFormat),
}
Expand description

A format a producer emits: a choice of pre-constructed SurfaceFormats.

See the module documentation. Name one of the constants (NV12 and friends) to get a value; match a variant to tell formats apart.

Variants§

§

Bgra8(SurfaceFormat)

BGRA8: 8-bit blue/green/red/alpha, straight alpha — the common desktop format.

§

Rgba8(SurfaceFormat)

RGBA8: 8-bit red/green/blue/alpha, straight alpha.

§

Nv12(SurfaceFormat)

NV12: 4:2:0 semi-planar, Cb then Cr — the universal decoder default.

§

Nv21(SurfaceFormat)

NV21: NV12 with the chroma components the other way round.

§

I420(SurfaceFormat)

I420 (YU12): 4:2:0 planar, Cb and Cr in their own planes after luma.

§

Yv12(SurfaceFormat)

YV12: I420 with the two chroma planes the other way round.

§

Nv16(SurfaceFormat)

NV16: 4:2:2 semi-planar, Cb then Cr.

§

Nv61(SurfaceFormat)

NV61: NV16 with the chroma components the other way round.

§

Yu16(SurfaceFormat)

YU16: 4:2:2 planar, Cb then Cr planes.

§

Yv16(SurfaceFormat)

YV16: YU16 with the two chroma planes the other way round.

§

Nv24(SurfaceFormat)

NV24: 4:4:4 semi-planar, Cb then Cr.

§

Yuv444(SurfaceFormat)

YUV444: 4:4:4 planar.

§

Mono8(SurfaceFormat)

Mono: a single 8-bit luma plane and no chroma at all.

§

P010(SurfaceFormat)

P010: 4:2:0 semi-planar, 10 bits in the high bits of a 16-bit word — HEVC Main10, VP9 profile 2 and AV1.

§

P012(SurfaceFormat)

P012: 4:2:0 semi-planar, 12 bits in a 16-bit word.

§

P016(SurfaceFormat)

P016: 4:2:0 semi-planar, a full 16-bit sample.

§

I010(SurfaceFormat)

I010: 4:2:0 planar, 10 bits in a 16-bit word.

§

I012(SurfaceFormat)

I012: 4:2:0 planar, 12 bits in a 16-bit word.

§

I016(SurfaceFormat)

I016: 4:2:0 planar, a full 16-bit sample.

§

P210(SurfaceFormat)

P210: 4:2:2 semi-planar, 10 bits in a 16-bit word.

§

P212(SurfaceFormat)

P212: 4:2:2 semi-planar, 12 bits in a 16-bit word.

§

P216(SurfaceFormat)

P216: 4:2:2 semi-planar, a full 16-bit sample.

§

P410(SurfaceFormat)

P410: 4:4:4 semi-planar, 10 bits in a 16-bit word.

§

P412(SurfaceFormat)

P412: 4:4:4 semi-planar, 12 bits in a 16-bit word.

§

P416(SurfaceFormat)

P416: 4:4:4 semi-planar, a full 16-bit sample.

§

Q410(SurfaceFormat)

Q410: 4:4:4 planar, 10 bits in a 16-bit word.

§

Q416(SurfaceFormat)

Q416: 4:4:4 planar, a full 16-bit sample.

Implementations§

Source§

impl SurfaceFormatKind

Source

pub const fn bgra8() -> Self

BGRA8: 8-bit blue/green/red/alpha, straight alpha.

Source

pub const fn rgba8() -> Self

RGBA8: 8-bit red/green/blue/alpha, straight alpha.

Source

pub const fn nv12() -> Self

NV12: 4:2:0 semi-planar, Cb then Cr — the universal decoder default.

Source

pub const fn nv21() -> Self

NV21: NV12 with the chroma components the other way round.

Source

pub const fn i420() -> Self

I420 (YU12): 4:2:0 planar, Cb and Cr in their own planes after luma.

Source

pub const fn yv12() -> Self

YV12: I420 with the two chroma planes the other way round.

Source

pub const fn nv16() -> Self

NV16: 4:2:2 semi-planar, Cb then Cr.

Source

pub const fn nv61() -> Self

NV61: NV16 with the chroma components the other way round.

Source

pub const fn yu16() -> Self

YU16: 4:2:2 planar, Cb then Cr planes.

Source

pub const fn yv16() -> Self

YV16: YU16 with the two chroma planes the other way round.

Source

pub const fn nv24() -> Self

NV24: 4:4:4 semi-planar, Cb then Cr.

Source

pub const fn yuv444() -> Self

YUV444: 4:4:4 planar.

Source

pub const fn mono8() -> Self

Mono: a single 8-bit luma plane and no chroma at all.

Source

pub const fn p010() -> Self

P010: 4:2:0 semi-planar, 10 bits in the high bits of a 16-bit word.

Source

pub const fn p012() -> Self

P012: 4:2:0 semi-planar, 12 bits in a 16-bit word.

Source

pub const fn p016() -> Self

P016: 4:2:0 semi-planar, a full 16-bit sample.

Source

pub const fn i010() -> Self

I010: 4:2:0 planar, 10 bits in a 16-bit word.

Source

pub const fn i012() -> Self

I012: 4:2:0 planar, 12 bits in a 16-bit word.

Source

pub const fn i016() -> Self

I016: 4:2:0 planar, a full 16-bit sample.

Source

pub const fn p210() -> Self

P210: 4:2:2 semi-planar, 10 bits in a 16-bit word.

Source

pub const fn p212() -> Self

P212: 4:2:2 semi-planar, 12 bits in a 16-bit word.

Source

pub const fn p216() -> Self

P216: 4:2:2 semi-planar, a full 16-bit sample.

Source

pub const fn p410() -> Self

P410: 4:4:4 semi-planar, 10 bits in a 16-bit word.

Source

pub const fn p412() -> Self

P412: 4:4:4 semi-planar, 12 bits in a 16-bit word.

Source

pub const fn p416() -> Self

P416: 4:4:4 semi-planar, a full 16-bit sample.

Source

pub const fn q410() -> Self

Q410: 4:4:4 planar, 10 bits in a 16-bit word.

Source

pub const fn q416() -> Self

Q416: 4:4:4 planar, a full 16-bit sample.

Source

pub const fn dimensions(self) -> SurfaceFormat

The pre-constructed shape this kind names.

Source

pub const fn is_yuv(self) -> bool

Whether the colour is YCbCr; see SurfaceFormat::is_yuv.

Source

pub const fn plane_count(self) -> usize

How many planes a buffer of this kind carries; see SurfaceFormat::plane_count.

Trait Implementations§

Source§

impl Clone for SurfaceFormatKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SurfaceFormatKind

Source§

impl Debug for SurfaceFormatKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SurfaceFormatKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

The format’s conventional name, for diagnostics — a dropped surface says which format it was.

Source§

impl Eq for SurfaceFormatKind

Source§

impl PartialEq for SurfaceFormatKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SurfaceFormatKind

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.