Skip to main content

Frame

Struct Frame 

Source
pub struct Frame<'a> { /* private fields */ }
Expand description

Represents a frame captured from a graphics capture item.

ยงExample

โ“˜
// Get a frame from the capture session
let mut buffer = frame.buffer()?;
buffer.save_as_image("screenshot.png", ImageFormat::Png)?;

Implementationsยง

Sourceยง

impl<'a> Frame<'a>

Source

pub const fn new( capture_frame: Direct3D11CaptureFrame, d3d_device: &'a ID3D11Device, frame_surface: IDirect3DSurface, frame_texture: ID3D11Texture2D, context: &'a ID3D11DeviceContext, desc: D3D11_TEXTURE2D_DESC, color_format: ColorFormat, title_bar_height: Option<u32>, ) -> Self

Constructs a new Frame.

Source

pub const fn width(&self) -> u32

Gets the width of the frame.

Source

pub fn dirty_regions(&self) -> Result<Vec<DirtyRegion>, Error>

Gets the dirty regions of the frame.

Source

pub const fn height(&self) -> u32

Gets the height of the frame.

Source

pub fn timestamp(&self) -> Result<TimeSpan, Error>

Gets the timestamp of the frame.

Source

pub const fn color_format(&self) -> ColorFormat

Gets the color format of the frame.

Source

pub const fn as_raw_surface(&self) -> &IDirect3DSurface

Gets the raw surface of the frame.

Source

pub const fn as_raw_texture(&self) -> &ID3D11Texture2D

Gets the raw texture of the frame.

Source

pub const fn device(&self) -> &ID3D11Device

Gets the underlying Direct3D device associated with this frame.

Source

pub const fn device_context(&self) -> &ID3D11DeviceContext

Gets the device context used for GPU operations on this frame.

Source

pub const fn desc(&self) -> &D3D11_TEXTURE2D_DESC

Gets the texture description of the frame.

Source

pub fn buffer(&mut self) -> Result<FrameBuffer<'_>, Error>

Gets the frame buffer.

Source

pub fn buffer_crop( &mut self, start_x: u32, start_y: u32, end_x: u32, end_y: u32, ) -> Result<FrameBuffer<'_>, Error>

Gets a cropped frame buffer.

Source

pub fn buffer_without_title_bar(&mut self) -> Result<FrameBuffer<'_>, Error>

Gets the frame buffer without the title bar.

Source

pub fn save_as_image<T: AsRef<Path>>( &mut self, path: T, format: ImageFormat, ) -> Result<(), Error>

Saves the frame buffer as an image to the specified path.

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> UnsafeUnpin for Frame<'a>

ยง

impl<'a> UnwindSafe for Frame<'a>

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> 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> Pointable for T

Sourceยง

const ALIGN: usize

The alignment of pointer.
Sourceยง

type Init = T

The type for initializers.
Sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.