#[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::Lrgb
PixelFormat::BgraColorSpace::Lrgb
PixelFormat::BgrColorSpace::Lrgb
PixelFormat::RgbaColorSpace::Lrgb
PixelFormat::RgbColorSpace::Lrgb
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

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.