#[non_exhaustive]#[repr(u8)]pub enum PixelFormat {
Rgb = 1,
Rgba = 2,
Bgra = 3,
Grey = 4,
Yuyv = 5,
Vyuy = 6,
Nv12 = 7,
Nv16 = 8,
PlanarRgb = 9,
PlanarRgba = 10,
}Expand description
Pixel format identifier.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Rgb = 1
Packed RGB [H, W, 3]
Rgba = 2
Packed RGBA [H, W, 4]
Bgra = 3
Packed BGRA [H, W, 4]
Grey = 4
Grayscale [H, W, 1]
Yuyv = 5
Packed YUV 4:2:2, YUYV byte order [H, W, 2]
Vyuy = 6
Packed YUV 4:2:2, VYUY byte order [H, W, 2]
Nv12 = 7
Semi-planar YUV 4:2:0 [H*3/2, W] or multiplane [H, W] + [H/2, W]
Nv16 = 8
Semi-planar YUV 4:2:2 [H*2, W] or multiplane [H, W] + [H, W]
PlanarRgb = 9
Planar RGB, channels-first [3, H, W]
PlanarRgba = 10
Planar RGBA, channels-first [4, H, W]
Implementations§
Source§impl PixelFormat
impl PixelFormat
Sourcepub const fn channels(&self) -> usize
pub const fn channels(&self) -> usize
Returns the number of channels for this pixel format.
For semi-planar formats (NV12, NV16), this returns 1 (the luma channel count for the primary plane). For packed formats, this is the total number of interleaved components per pixel.
Sourcepub const fn layout(&self) -> PixelLayout
pub const fn layout(&self) -> PixelLayout
Returns the memory layout category for this pixel format.
Sourcepub const fn to_fourcc(&self) -> u32
pub const fn to_fourcc(&self) -> u32
Returns the V4L2/DRM FourCC code for this format, or 0 for formats
that have no standard FourCC representation (e.g., PlanarRgb).
Sourcepub const fn from_fourcc(fourcc: u32) -> Option<Self>
pub const fn from_fourcc(fourcc: u32) -> Option<Self>
Converts a V4L2/DRM FourCC code to a PixelFormat, returning None
for unrecognized or zero codes.
Trait Implementations§
Source§impl Clone for PixelFormat
impl Clone for PixelFormat
Source§fn clone(&self) -> PixelFormat
fn clone(&self) -> PixelFormat
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PixelFormat
impl Debug for PixelFormat
Source§impl<'de> Deserialize<'de> for PixelFormat
impl<'de> Deserialize<'de> for PixelFormat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for PixelFormat
impl Display for PixelFormat
Source§impl Hash for PixelFormat
impl Hash for PixelFormat
Source§impl PartialEq for PixelFormat
impl PartialEq for PixelFormat
Source§impl Serialize for PixelFormat
impl Serialize for PixelFormat
impl Copy for PixelFormat
impl Eq for PixelFormat
impl StructuralPartialEq for PixelFormat
Auto Trait Implementations§
impl Freeze for PixelFormat
impl RefUnwindSafe for PixelFormat
impl Send for PixelFormat
impl Sync for PixelFormat
impl Unpin for PixelFormat
impl UnsafeUnpin for PixelFormat
impl UnwindSafe for PixelFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more