#[repr(C)]
pub struct ImageFormat { pub pixel_format: PixelFormat, pub color_space: ColorSpace, pub num_planes: u32, }
Expand description

Describes how the image data is laid out in memory and its color space.

Note

Not all combinations of pixel format, color space and number of planes describe a valid image format.

Each pixel format has one or more compatible color spaces:

pixel formatcolor space
PixelFormat::ArgbColorSpace::Rgb
PixelFormat::BgraColorSpace::Rgb
PixelFormat::BgrColorSpace::Rgb
PixelFormat::RgbaColorSpace::Rgb
PixelFormat::RgbColorSpace::Rgb
PixelFormat::I444ColorSpace::Bt601(FR), ColorSpace::Bt709(FR)
PixelFormat::I422ColorSpace::Bt601(FR), ColorSpace::Bt709(FR)
PixelFormat::I420ColorSpace::Bt601(FR), ColorSpace::Bt709(FR)
PixelFormat::Nv12ColorSpace::Bt601(FR), ColorSpace::Bt709(FR)

Some pixel formats might impose additional restrictions on the accepted number of planes and the image size:

pixel formatsubsamplingwh#planes#1#2#3
PixelFormat::Argb4:4:41argb:4
PixelFormat::Bgra4:4:41bgra:4
PixelFormat::Bgr4:4:41bgr:3
PixelFormat::Rgba4:4:41rgba:4
PixelFormat::Rgb4:4:41rgb:3
PixelFormat::I4444:4:43y:1u:1v:1
PixelFormat::I4224:2:221, 3y:1u:1/2v:1/2
PixelFormat::I4204:2:0223y:1u:1/4v:1/4
PixelFormat::Nv124:2:0221, 2y:1uv:1/2

The values reported in columns w and h, when specified, indicate that the described image should have width and height that are multiples of the specified values

Fields§

§pixel_format: PixelFormat

Pixel format

§color_space: ColorSpace

Color space

§num_planes: u32

Number of planes

Trait Implementations§

source§

impl Debug for ImageFormat

source§

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

Formats the value using the given formatter. Read more

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<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<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.