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

Capture screen to a chunk of shared memory.

Implementations§

source§

impl<'a> SharedCapturer<'a>

source

pub fn new(ctx: &'a DuplicationContext, name: &str) -> Result<Self>

source

pub fn open(ctx: &'a DuplicationContext, name: &str) -> Result<Self>

Trait Implementations§

source§

impl<'a> Capturer for SharedCapturer<'a>

source§

fn dxgi_output_desc(&self) -> Result<DXGI_OUTPUT_DESC>

This is usually used to get the screen’s position and size.
source§

fn dxgi_outdupl_desc(&self) -> DXGI_OUTDUPL_DESC

This is usually used to get the screen’s pixel width/height and buffer size.
source§

fn buffer(&self) -> &[u8]

Get the buffer of the last captured frame. The buffer is in BGRA32 format.
source§

fn buffer_mut(&mut self) -> &mut [u8]

Get the buffer of the last captured frame. The buffer is in BGRA32 format.
source§

fn check_buffer(&self) -> Result<()>

Check buffer size.
source§

fn pointer_shape_buffer(&self) -> &[u8]

Get the buffer of the captured pointer shape.
source§

fn pointer_shape_updated(&self) -> bool

Return true if the pointer shape is updated.
source§

fn capture(&mut self) -> Result<DXGI_OUTDUPL_FRAME_INFO>

Capture the screen and return the frame info. The pixel data is stored in the buffer.
source§

fn safe_capture(&mut self) -> Result<DXGI_OUTDUPL_FRAME_INFO>

Check buffer size before capture. The pixel data is stored in the buffer.
source§

fn capture_with_pointer_shape( &mut self ) -> Result<(DXGI_OUTDUPL_FRAME_INFO, Option<DXGI_OUTDUPL_POINTER_SHAPE_INFO>)>

Capture the screen and return the frame info. The pixel data is stored in the buffer. If mouse is updated, the Option<DXGI_OUTDUPL_POINTER_SHAPE_INFO> is Some. The pointer shape is stored in the pointer_shape_buffer.
source§

fn safe_capture_with_pointer_shape( &mut self ) -> Result<(DXGI_OUTDUPL_FRAME_INFO, Option<DXGI_OUTDUPL_POINTER_SHAPE_INFO>)>

Check buffer size before capture. The pixel data is stored in the buffer. If mouse is updated, the Option<DXGI_OUTDUPL_POINTER_SHAPE_INFO> is Some. The pointer shape is stored in the pointer_shape_buffer.
source§

impl<'a> Drop for SharedCapturer<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for SharedCapturer<'a>

§

impl<'a> !Send for SharedCapturer<'a>

§

impl<'a> !Sync for SharedCapturer<'a>

§

impl<'a> Unpin for SharedCapturer<'a>

§

impl<'a> UnwindSafe for SharedCapturer<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere 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 Twhere 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.