pub struct PixelFormatInfo { /* private fields */ }Expand description
Compile-time pixel format properties.
Records first-plane bytes per pixel, plane category, alpha presence and
sample width. See PixelFormat::buffer_len for storage size and
PixelFormat::send_tail_room for the SDK’s extra readable send bytes.
§Examples
use grafton_ndi::{PixelFormat, FormatCategory};
let info = PixelFormat::Bgra.info();
assert_eq!(info.bytes_per_pixel(), 4);
assert_eq!(info.category(), FormatCategory::Packed);
let info = PixelFormat::Nv12.info();
assert_eq!(info.bytes_per_pixel(), 1);
assert_eq!(info.category(), FormatCategory::SemiPlanar420);Implementations§
Source§impl PixelFormatInfo
impl PixelFormatInfo
Sourcepub const fn bytes_per_pixel(&self) -> u8
pub const fn bytes_per_pixel(&self) -> u8
Get bytes per pixel for packed formats, or first-plane bytes per pixel for planar and semi-planar formats (the Y plane, or the UYVY plane of UYVA).
Sourcepub const fn category(&self) -> FormatCategory
pub const fn category(&self) -> FormatCategory
Get the format category.
Sourcepub const fn is_planar_420(&self) -> bool
pub const fn is_planar_420(&self) -> bool
Returns true if this is a planar 4:2:0 format (YV12, I420, or NV12).
Trait Implementations§
Source§impl Clone for PixelFormatInfo
impl Clone for PixelFormatInfo
impl Copy for PixelFormatInfo
Source§impl Debug for PixelFormatInfo
impl Debug for PixelFormatInfo
impl Eq for PixelFormatInfo
Source§impl Hash for PixelFormatInfo
impl Hash for PixelFormatInfo
Source§impl PartialEq for PixelFormatInfo
impl PartialEq for PixelFormatInfo
impl StructuralPartialEq for PixelFormatInfo
Auto Trait Implementations§
impl Freeze for PixelFormatInfo
impl RefUnwindSafe for PixelFormatInfo
impl Send for PixelFormatInfo
impl Sync for PixelFormatInfo
impl Unpin for PixelFormatInfo
impl UnsafeUnpin for PixelFormatInfo
impl UnwindSafe for PixelFormatInfo
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
Mutably borrows from an owned value. Read more