FrameRef

Struct FrameRef 

Source
pub struct FrameRef<'core> { /* private fields */ }
Expand description

A reference to a ref-counted frame.

Methods from Deref<Target = Frame<'core>>§

Source

pub fn format(&self) -> Format<'core>

Returns the frame format.

Source

pub fn width(&self, plane: usize) -> usize

Returns the width of a plane, in pixels.

The width depends on the plane number because of the possible chroma subsampling.

§Panics

Panics if plane >= format().plane_count().

Source

pub fn height(&self, plane: usize) -> usize

Returns the height of a plane, in pixels.

The height depends on the plane number because of the possible chroma subsampling.

§Panics

Panics if plane >= format().plane_count().

Source

pub fn resolution(&self, plane: usize) -> Resolution

Returns the resolution of a plane.

The resolution depends on the plane number because of the possible chroma subsampling.

§Panics

Panics if plane is invalid for this frame.

Source

pub fn stride(&self, plane: usize) -> usize

Returns the distance in bytes between two consecutive lines of a plane.

§Panics

Panics if plane >= format().plane_count().

Source

pub fn plane_row<T: Component>(&self, plane: usize, row: usize) -> &[T]

Returns a slice of a plane’s pixel row.

§Panics

Panics if the requested plane, row or component type is invalid.

Source

pub fn plane<T: Component>(&self, plane: usize) -> Result<&[T], NonZeroPadding>

Returns a slice of the plane’s pixels.

The length of the returned slice is height() * width(). If the pixel data has non-zero padding (that is, stride() is larger than width()), an error is returned, since returning the data slice would open access to uninitialized bytes.

§Panics

Panics if the requested plane or component type is invalid.

Source

pub fn data_ptr(&self, plane: usize) -> *const u8

Returns a pointer to the plane’s pixels.

The pointer points to an array with a length of height() * stride() and is valid for as long as the frame is alive.

§Panics

Panics if plane >= format().plane_count().

Source

pub fn data_row(&self, plane: usize, row: usize) -> &[u8]

Returns a slice of a plane’s pixel row.

The length of the returned slice is equal to width() * format().bytes_per_sample().

§Panics

Panics if plane >= format().plane_count() or if row >= height().

Source

pub fn data(&self, plane: usize) -> Result<&[u8], NonZeroPadding>

Returns a slice of the plane’s pixels.

The length of the returned slice is height() * width() * format().bytes_per_sample(). If the pixel data has non-zero padding (that is, stride() is larger than width()), an error is returned, since returning the data slice would open access to uninitialized bytes.

§Panics

Panics if plane >= format().plane_count() or if row >= height().

Source

pub fn props(&self) -> MapRef<'_, '_>

Returns a map of frame’s properties.

Trait Implementations§

Source§

impl<'core> Clone for FrameRef<'core>

Source§

fn clone(&self) -> Self

Returns a duplicate 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<'core> Debug for FrameRef<'core>

Source§

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

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

impl<'core> Deref for FrameRef<'core>

Source§

type Target = Frame<'core>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'map, 'elem: 'map> FilterArgument<'map, 'elem> for FrameRef<'elem>

Source§

fn type_name() -> &'static str

Returns the VapourSynth type name for this argument type.
Source§

impl<'core> From<FrameRefMut<'core>> for FrameRef<'core>

Source§

fn from(x: FrameRefMut<'core>) -> Self

Converts to this type from the input type.
Source§

impl<'map, 'elem: 'map> Value<'map, 'elem> for FrameRef<'elem>

Source§

fn get_from_map(map: &Map<'elem>, key: &str) -> Result<Self>

Retrieves the value from the map.
Source§

fn get_iter_from_map( map: &'map Map<'elem>, key: &str, ) -> Result<ValueIter<'map, 'elem, Self>>

Retrieves an iterator over the values from the map.
Source§

fn store_in_map(map: &mut Map<'elem>, key: &str, x: &Self) -> Result<()>

Sets the property value in the map.
Source§

fn append_to_map(map: &mut Map<'elem>, key: &str, x: &Self) -> Result<()>

Appends the value to the map.

Auto Trait Implementations§

§

impl<'core> Freeze for FrameRef<'core>

§

impl<'core> RefUnwindSafe for FrameRef<'core>

§

impl<'core> Send for FrameRef<'core>

§

impl<'core> Sync for FrameRef<'core>

§

impl<'core> Unpin for FrameRef<'core>

§

impl<'core> UnwindSafe for FrameRef<'core>

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<'map, 'elem, T> FilterParameter<'map, 'elem> for T
where 'elem: 'map, T: FilterArgument<'map, 'elem>,

Source§

type Argument = T

The underlying argument type for this parameter type.
Source§

fn is_array() -> bool

Returns whether this parameter is an array.
Source§

fn is_optional() -> bool

Returns whether this parameter is optional.
Source§

fn get_from_map(map: &'map Map<'elem>, key: &str) -> T

Retrieves this parameter from the given map.
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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>,

Source§

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>,

Source§

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.