Struct vapoursynth::frame::Frame
source · [−]pub struct Frame<'core> { /* private fields */ }
Expand description
One frame of a clip.
Implementations
sourceimpl<'core> Frame<'core>
impl<'core> Frame<'core>
sourcepub fn width(&self, plane: usize) -> usize
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()
.
sourcepub fn height(&self, plane: usize) -> usize
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()
.
sourcepub fn resolution(&self, plane: usize) -> Resolution
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.
sourcepub fn stride(&self, plane: usize) -> usize
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()
.
sourcepub fn plane_row<T: Component>(&self, plane: usize, row: usize) -> &[T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn plane_row<T: Component>(&self, plane: usize, row: usize) -> &[T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns a slice of a plane’s pixel row.
Panics
Panics if the requested plane, row or component type is invalid.
sourcepub fn plane_row_mut<T: Component>(
&mut self,
plane: usize,
row: usize
) -> &mut [T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn plane_row_mut<T: Component>(
&mut self,
plane: usize,
row: usize
) -> &mut [T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns a mutable slice of a plane’s pixel row.
Panics
Panics if the requested plane, row or component type is invalid.
sourcepub fn plane<T: Component>(&self, plane: usize) -> Result<&[T], NonZeroPadding>
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.
sourcepub fn plane_mut<T: Component>(
&mut self,
plane: usize
) -> Result<&mut [T], NonZeroPadding>
pub fn plane_mut<T: Component>(
&mut self,
plane: usize
) -> Result<&mut [T], NonZeroPadding>
Returns a mutable 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.
sourcepub fn data_ptr(&self, plane: usize) -> *const u8
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()
.
sourcepub fn data_ptr_mut(&mut self, plane: usize) -> *mut u8
pub fn data_ptr_mut(&mut self, plane: usize) -> *mut u8
Returns a mutable 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()
.
sourcepub fn data_row(&self, plane: usize, row: usize) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn data_row(&self, plane: usize, row: usize) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [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()
.
sourcepub fn data_row_mut(&mut self, plane: usize, row: usize) -> &mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn data_row_mut(&mut self, plane: usize, row: usize) -> &mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns a mutable 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()
.
sourcepub fn data(&self, plane: usize) -> Result<&[u8], NonZeroPadding>
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()
.
sourcepub fn data_mut(&mut self, plane: usize) -> Result<&mut [u8], NonZeroPadding>
pub fn data_mut(&mut self, plane: usize) -> Result<&mut [u8], NonZeroPadding>
Returns a mutable 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()
.
Trait Implementations
impl<'core> Send for Frame<'core>
impl<'core> Sync for Frame<'core>
Auto Trait Implementations
impl<'core> RefUnwindSafe for Frame<'core>
impl<'core> Unpin for Frame<'core>
impl<'core> UnwindSafe for Frame<'core>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more