pub struct DxgiDuplicationFrame<'a> { /* private fields */ }Expand description
Represents a pre-assembled full desktop image for the current frame,
backed by the internal GPU texture.
Call DxgiDuplicationFrame::buffer to obtain a CPU-readable crate::frame::FrameBuffer.
Implementations§
Source§impl<'a> DxgiDuplicationFrame<'a>
impl<'a> DxgiDuplicationFrame<'a>
Sourcepub const fn format(&self) -> DxgiDuplicationFormat
pub const fn format(&self) -> DxgiDuplicationFormat
Gets the pixel format of the frame.
Sourcepub const fn device(&self) -> &ID3D11Device
pub const fn device(&self) -> &ID3D11Device
Gets the underlying Direct3D device associated with this frame.
Sourcepub const fn device_context(&self) -> &ID3D11DeviceContext
pub const fn device_context(&self) -> &ID3D11DeviceContext
Gets the underlying Direct3D device context used for GPU operations.
Sourcepub const fn duplication(&self) -> &IDXGIOutputDuplication
pub const fn duplication(&self) -> &IDXGIOutputDuplication
Gets the underlying IDXGIOutputDuplication interface.
Sourcepub const fn texture(&self) -> &ID3D11Texture2D
pub const fn texture(&self) -> &ID3D11Texture2D
Gets the underlying [windows::Win32::Graphics::Direct3D11::ID3D11Texture2D] interface.
Sourcepub const fn texture_desc(&self) -> &D3D11_TEXTURE2D_DESC
pub const fn texture_desc(&self) -> &D3D11_TEXTURE2D_DESC
Gets the [windows::Win32::Graphics::Direct3D11::D3D11_TEXTURE2D_DESC] of the underlying
texture.
Sourcepub const fn frame_info(&self) -> &DXGI_OUTDUPL_FRAME_INFO
pub const fn frame_info(&self) -> &DXGI_OUTDUPL_FRAME_INFO
Gets the frame information for the current frame.
Sourcepub fn buffer<'b>(&'b mut self) -> Result<DxgiDuplicationFrameBuffer<'b>, Error>
pub fn buffer<'b>(&'b mut self) -> Result<DxgiDuplicationFrameBuffer<'b>, Error>
Maps the internal frame into CPU accessible memory and returns a
crate::frame::FrameBuffer.
This creates a staging texture, copies the internal texture into it,
and maps it for CPU read/write. The returned buffer may include row padding;
you can use crate::frame::FrameBuffer::as_nopadding_buffer to obtain a packed
representation.
Sourcepub fn buffer_crop<'b>(
&'b mut self,
start_x: u32,
start_y: u32,
end_x: u32,
end_y: u32,
) -> Result<DxgiDuplicationFrameBuffer<'b>, Error>
pub fn buffer_crop<'b>( &'b mut self, start_x: u32, start_y: u32, end_x: u32, end_y: u32, ) -> Result<DxgiDuplicationFrameBuffer<'b>, Error>
Gets a cropped frame buffer of the duplication frame.
Sourcepub fn buffer_with<'s>(
&'s mut self,
staging: &'s mut StagingTexture,
) -> Result<DxgiDuplicationFrameBuffer<'s>, Error>
pub fn buffer_with<'s>( &'s mut self, staging: &'s mut StagingTexture, ) -> Result<DxgiDuplicationFrameBuffer<'s>, Error>
Advanced: reuse your own CPU staging texture (crate::d3d11::StagingTexture).
This avoids per-frame allocations and lets you manage the texture’s lifetime.
The staging texture must be a D3D11_USAGE_STAGING 2D texture with CPU read/write access,
matching the frame’s width/height/format.
Sourcepub fn buffer_crop_with<'s>(
&'s mut self,
staging: &'s mut StagingTexture,
start_x: u32,
start_y: u32,
end_x: u32,
end_y: u32,
) -> Result<DxgiDuplicationFrameBuffer<'s>, Error>
pub fn buffer_crop_with<'s>( &'s mut self, staging: &'s mut StagingTexture, start_x: u32, start_y: u32, end_x: u32, end_y: u32, ) -> Result<DxgiDuplicationFrameBuffer<'s>, Error>
Advanced: cropped buffer using a preallocated staging texture. The provided staging texture must be a D3D11_USAGE_STAGING 2D texture with CPU read/write access, of the same format as the duplication frame, and large enough to contain the crop region.
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>
Saves the frame buffer as an image to the specified path.
Auto Trait Implementations§
impl<'a> Freeze for DxgiDuplicationFrame<'a>
impl<'a> RefUnwindSafe for DxgiDuplicationFrame<'a>
impl<'a> Send for DxgiDuplicationFrame<'a>
impl<'a> Sync for DxgiDuplicationFrame<'a>
impl<'a> Unpin for DxgiDuplicationFrame<'a>
impl<'a> UnsafeUnpin for DxgiDuplicationFrame<'a>
impl<'a> UnwindSafe for DxgiDuplicationFrame<'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
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>
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>
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