pub struct PixelFormat(/* private fields */);Expand description
Represents libcamera::PixelFormat, which itself is a pair of fourcc code and u64 modifier as defined in libdrm.
Implementations§
Source§impl PixelFormat
impl PixelFormat
Sourcepub const fn new(fourcc: u32, modifier: u64) -> Self
pub const fn new(fourcc: u32, modifier: u64) -> Self
Constructs new PixelFormat from given fourcc code and modifier.
§Examples
use libcamera::pixel_format::PixelFormat;
// Constructs MJPEG pixel format
const PIXEL_FORMAT_MJPEG: PixelFormat =
PixelFormat::new(u32::from_le_bytes([b'M', b'J', b'P', b'G']), 0);pub fn fourcc(&self) -> u32
pub fn set_fourcc(&mut self, fourcc: u32)
pub fn modifier(&self) -> u64
pub fn set_modifier(&mut self, modifier: u64)
Sourcepub fn has_modifier(&self) -> bool
pub fn has_modifier(&self) -> bool
Returns true if this format has a non-zero modifier set.
Sourcepub fn stride(&self, width: u32, plane: u32, align: u32) -> u32
pub fn stride(&self, width: u32, plane: u32, align: u32) -> u32
Compute the stride for a plane given width and optional alignment.
Sourcepub fn plane_size(&self, size: Size, plane: u32, align: u32) -> u32
pub fn plane_size(&self, size: Size, plane: u32, align: u32) -> u32
Compute plane size for the given frame size and plane index.
Sourcepub fn frame_size(&self, size: Size, align: u32) -> u32
pub fn frame_size(&self, size: Size, align: u32) -> u32
Compute total frame size for the given dimensions.
Sourcepub fn clear_modifier(&mut self)
pub fn clear_modifier(&mut self)
Clears the modifier to zero.
Sourcepub const fn from_raw_parts(fourcc: u32, modifier: u64) -> Self
pub const fn from_raw_parts(fourcc: u32, modifier: u64) -> Self
Constructs a PixelFormat from raw (fourcc, modifier) parts.
Sourcepub fn parse(name: &str) -> Option<Self>
pub fn parse(name: &str) -> Option<Self>
Parse a PixelFormat from its string representation (e.g. “YUYV”).
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true if the PixelFormat represents a valid libcamera format.
pub fn info(&self) -> Option<PixelFormatInfo>
Trait Implementations§
Source§impl Clone for PixelFormat
impl Clone for PixelFormat
Source§fn clone(&self) -> PixelFormat
fn clone(&self) -> PixelFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PixelFormat
impl Debug for PixelFormat
Source§impl Display for PixelFormat
impl Display for PixelFormat
Source§impl From<DrmFormat> for PixelFormat
impl From<DrmFormat> for PixelFormat
Source§impl FromStr for PixelFormat
impl FromStr for PixelFormat
Source§impl PartialEq for PixelFormat
impl PartialEq for PixelFormat
Source§impl TryFrom<PixelFormat> for DrmFormat
impl TryFrom<PixelFormat> for DrmFormat
impl Copy for PixelFormat
impl Eq 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
Mutably borrows from an owned value. Read more