Enum basic_frame::DynamicFrame

source ·
pub enum DynamicFrame {
Show 14 variants Mono8(BasicFrame<Mono8>), Mono32f(BasicFrame<Mono32f>), RGB8(BasicFrame<RGB8>), BayerRG8(BasicFrame<BayerRG8>), BayerRG32f(BasicFrame<BayerRG32f>), BayerGB8(BasicFrame<BayerGB8>), BayerGB32f(BasicFrame<BayerGB32f>), BayerGR8(BasicFrame<BayerGR8>), BayerGR32f(BasicFrame<BayerGR32f>), BayerBG8(BasicFrame<BayerBG8>), BayerBG32f(BasicFrame<BayerBG32f>), YUV444(BasicFrame<YUV444>), YUV422(BasicFrame<YUV422>), NV12(BasicFrame<NV12>),
}
Expand description

An image whose pixel format is known only at runtime.

When reading an image from disk, for example, its pixel format is not known in advance. This enum represents the different possible formats as different variants.

Note that we do not implement ImageData<FMT> trait because the pixel format (parameterized by FMT) is not known at compile-time for DynamicFrame.

Variants§

Implementations§

source§

impl DynamicFrame

source

pub fn new( width: u32, height: u32, stride: u32, extra: Box<dyn HostTimeData>, image_data: Vec<u8>, pixel_format: PixFmt ) -> DynamicFrame

source

pub fn copy_from<FMT: PixelFormat>(frame: &dyn ImageStrideTime<FMT>) -> Self

source

pub fn from<FRAME, FMT>(frame: FRAME) -> Self
where FRAME: ImageStrideTime<FMT> + Into<Vec<u8>>, FMT: PixelFormat,

source§

impl DynamicFrame

source

pub fn as_basic<FMT>(self) -> Option<BasicFrame<FMT>>
where FMT: PixelFormat,

Return the image as a BasicFrame of the given pixel format.

This is done by moving the data. No copy is made.

If the image is a different pixel format than requested, None will be returned.

To convert the image data if necessary, use Self::into_pixel_format.

source

pub fn into_pixel_format<FMT>(self) -> Result<BasicFrame<FMT>, Error>
where FMT: PixelFormat,

Return the image as a BasicFrame converting the data to the requested pixel format as necessary.

To avoid converting the data, use Self::as_basic.

source

pub fn pixel_format(&self) -> PixFmt

source

pub fn force_pixel_format(self, pixfmt: PixFmt) -> DynamicFrame

Force the frame into a new pixel format without altering the data.

source

pub fn width(&self) -> u32

source

pub fn height(&self) -> u32

source

pub fn image_data_without_format(&self) -> &[u8]

Get a view of the image data.

Note that this discards any type information about the pixel format.

source

pub fn into_data_extra(self) -> (Vec<u8>, Box<dyn HostTimeData>)

Trait Implementations§

source§

impl Clone for DynamicFrame

source§

fn clone(&self) -> DynamicFrame

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DynamicFrame

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl ExtraTimeData for DynamicFrame

source§

fn extra(&self) -> &dyn HostTimeData

source§

impl From<DynamicFrame> for Vec<u8>

source§

fn from(orig: DynamicFrame) -> Self

Converts to this type from the input type.
source§

impl PartialEq for DynamicFrame

source§

fn eq(&self, other: &DynamicFrame) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Stride for DynamicFrame

source§

fn stride(&self) -> usize

the width (in bytes) of each row of image data Read more
source§

impl StructuralPartialEq for DynamicFrame

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for T
where T: Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.