pub struct Frame<'a> { /* private fields */ }Expand description
Implementationsยง
Sourceยงimpl<'a> Frame<'a>
impl<'a> Frame<'a>
Sourcepub fn new(
d3d_device: &'a ID3D11Device,
frame_surface: IDirect3DSurface,
frame_texture: ID3D11Texture2D,
time: TimeSpan,
context: &'a ID3D11DeviceContext,
buffer: &'a mut Vec<u8>,
width: u32,
height: u32,
color_format: ColorFormat,
) -> Self
pub fn new( d3d_device: &'a ID3D11Device, frame_surface: IDirect3DSurface, frame_texture: ID3D11Texture2D, time: TimeSpan, context: &'a ID3D11DeviceContext, buffer: &'a mut Vec<u8>, width: u32, height: u32, color_format: ColorFormat, ) -> Self
Create a new Frame.
ยงArguments
d3d_device- The ID3D11Device used for creating the frame.frame_surface- The IDirect3DSurface representing the frame surface.frame_texture- The ID3D11Texture2D representing the frame texture.time- The TimeSpan representing the frame time.context- The ID3D11DeviceContext used for copying the texture.buffer- The mutable Vecrepresenting the frame buffer. width- The width of the frame.height- The height of the frame.color_format- The ColorFormat of the frame.
ยงReturns
A new Frame instance.
Sourcepub const fn color_format(&self) -> ColorFormat
pub const fn color_format(&self) -> ColorFormat
Sourcepub const unsafe fn as_raw_surface(&self) -> &IDirect3DSurface
pub const unsafe fn as_raw_surface(&self) -> &IDirect3DSurface
Sourcepub const unsafe fn as_raw_texture(&self) -> &ID3D11Texture2D
pub const unsafe fn as_raw_texture(&self) -> &ID3D11Texture2D
Get the raw texture of the frame.
ยงReturns
The ID3D11Texture2D representing the raw texture of the frame.
Sourcepub fn buffer(&mut self) -> Result<FrameBuffer<'_>, Error>
pub fn buffer(&mut self) -> Result<FrameBuffer<'_>, Error>
Sourcepub fn buffer_crop(
&mut self,
start_width: u32,
start_height: u32,
end_width: u32,
end_height: u32,
) -> Result<FrameBuffer<'_>, Error>
pub fn buffer_crop( &mut self, start_width: u32, start_height: u32, end_width: u32, end_height: u32, ) -> Result<FrameBuffer<'_>, Error>
Get a cropped frame buffer.
ยงArguments
start_width- The starting width of the cropped frame.start_height- The starting height of the cropped frame.end_width- The ending width of the cropped frame.end_height- The ending height of the cropped frame.
ยงReturns
The FrameBuffer containing the cropped frame data.
Sourcepub fn save_as_image<T: AsRef<Path>>(
&mut self,
path: T,
format: ImageFormat,
) -> Result<(), Error>
pub fn save_as_image<T: AsRef<Path>>( &mut self, path: T, format: ImageFormat, ) -> Result<(), Error>
Auto Trait Implementationsยง
impl<'a> Freeze for Frame<'a>
impl<'a> RefUnwindSafe for Frame<'a>
impl<'a> !Send for Frame<'a>
impl<'a> !Sync for Frame<'a>
impl<'a> Unpin for Frame<'a>
impl<'a> !UnwindSafe for Frame<'a>
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
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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