pub enum PixelFormat {
Show 15 variants
I420,
I422,
I444,
I010,
I012,
I210,
I212,
I410,
I412,
NV12,
YUYV,
RGBA,
BGRA,
RGB,
BGR,
}Expand description
Supported pixel formats
Variants§
I420
Y, U and V planes, 4:2:0 sub sampling, 8 bits per sample
I422
Y, U and V planes, 4:2:2 sub sampling, 8 bits per sample
I444
Y, U and V planes, 4:4:4 sub sampling, 8 bits per sample
I010
Y, U, and V planes, 4:2:0 sub sampling, 10 bits per sample
I012
Y, U, and V planes, 4:2:0 sub sampling, 12 bits per sample
I210
Y, U, and V planes, 4:2:2 sub sampling, 10 bits per sample
I212
Y, U, and V planes, 4:2:2 sub sampling, 10 bits per sample
I410
Y, U, and V planes, 4:4:4 sub sampling, 10 bits per sample
I412
Y, U, and V planes, 4:4:4 sub sampling, 12 bits per sample
NV12
Y and interleaved UV planes, 4:2:0 sub sampling
YUYV
Single YUYV, 4:2:2 sub sampling
RGBA
Single RGBA interleaved plane
BGRA
Single BGRA interleaved plane
RGB
Single RGB interleaved plane
BGR
Single BGR interleaved plane
Implementations§
Source§impl PixelFormat
impl PixelFormat
Sourcepub fn buffer_size(self, width: usize, height: usize) -> usize
pub fn buffer_size(self, width: usize, height: usize) -> usize
Calculate the required buffer size given the PixelFormat self and image dimensions (in pixel width, height).
The size is the amount of primitives (u8, u16) so when allocating size this must be accounted for.
Sourcepub fn packed_strides(self, width: usize) -> Vec<usize>
pub fn packed_strides(self, width: usize) -> Vec<usize>
Calculate the strides of an image in a packed buffer
Sourcepub fn bounds_check<'a>(
self,
planes: impl Iterator<Item = (&'a [u8], usize)>,
width: usize,
height: usize,
) -> Result<(), BoundsCheckError>
pub fn bounds_check<'a>( self, planes: impl Iterator<Item = (&'a [u8], usize)>, width: usize, height: usize, ) -> Result<(), BoundsCheckError>
Check if the given planes+strides are valid for dimensions
pub fn bits_per_component(&self) -> usize
pub fn variants() -> impl IntoIterator<Item = Self>
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 Hash for PixelFormat
impl Hash for PixelFormat
Source§impl Ord for PixelFormat
impl Ord for PixelFormat
Source§fn cmp(&self, other: &PixelFormat) -> Ordering
fn cmp(&self, other: &PixelFormat) -> 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 PixelFormat
impl PartialEq for PixelFormat
Source§impl PartialOrd for PixelFormat
impl PartialOrd 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 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