跳到主要内容

DxgiDuplicationFrame

搜索

结构体 DxgiDuplicationFrame 

Source
pub struct DxgiDuplicationFrame<'a> { /* private fields */ }
展开描述

表示当前帧已预组装好的完整桌面图像, 由内部 GPU 纹理支持。 调用 DxgiDuplicationFrame::buffer 可获得 CPU 可读的 crate::frame::FrameBuffer

实现§

Source§

impl<'a> DxgiDuplicationFrame<'a>

Source

pub const fn width(&self) -> u32

获取该帧的宽度。

Source

pub const fn height(&self) -> u32

获取该帧的高度。

Source

pub const fn format(&self) -> DxgiDuplicationFormat

获取该帧的像素格式。

Source

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

获取与该帧关联的底层 Direct3D 设备。

Source

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

获取用于 GPU 操作的底层 Direct3D 设备上下文。

Source

pub const fn duplication(&self) -> &IDXGIOutputDuplication

获取底层的 IDXGIOutputDuplication 接口。

Source

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

获取底层的 [windows::Win32::Graphics::Direct3D11::ID3D11Texture2D] 接口。

Source

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

获取底层纹理的 [windows::Win32::Graphics::Direct3D11::D3D11_TEXTURE2D_DESC]。

Source

pub const fn frame_info(&self) -> &DXGI_OUTDUPL_FRAME_INFO

获取当前帧的帧信息。

Source

pub fn buffer<'b>(&'b mut self) -> Result<DxgiDuplicationFrameBuffer<'b>, Error>

将内部帧映射到 CPU 可访问的内存,并返回 crate::frame::FrameBuffer

此方法会创建一张 staging 纹理,将内部纹理复制到其中,并映射为 CPU 可读/可写。 返回的缓冲区可能包含行填充(row padding);你可以使用 crate::frame::FrameBuffer::as_nopadding_buffer 获取紧凑(无填充)表示。

Source

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

获取该复制帧的裁剪缓冲区。

Source

pub fn buffer_with<'s>( &'s mut self, staging: &'s mut StagingTexture, ) -> Result<DxgiDuplicationFrameBuffer<'s>, Error>

进阶用法:复用你自己的 CPU staging 纹理 (crate::d3d11::StagingTexture)。

这可以避免每帧分配,并允许你自行管理纹理的生命周期。 staging 纹理必须是 D3D11_USAGE_STAGING 的 2D 纹理,具有 CPU 读/写访问权限, 且与该帧的宽度/高度/格式相匹配。

Source

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>

进阶用法:使用预分配的 staging 纹理进行裁剪。 所提供的 staging 纹理必须是 D3D11_USAGE_STAGING 的 2D 纹理,具有 CPU 读/写访问权限, 格式与该复制帧相同,且大小足以容纳裁剪区域。

Source

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

将帧缓冲区保存为指定路径的图像。

自动 Trait 实现§

通用实现§

Source§

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

Source§

fn type_id(&self) -> TypeId

获取 selfTypeId阅读更多
Source§

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

Source§

fn borrow(&self) -> &T

从拥有的值不可变地借用。阅读更多
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

从拥有的值可变地借用。阅读更多
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

原样返回参数。

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

调用 U::from(self)

也就是说,此转换由 From<T> for U 的实现自行决定。

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

into_lefttrue,则将 self 转换为 Left 变体 (属于 Either<Self, Self>)。 否则将 self 转换为 Right 变体 (属于 Either<Self, Self>)。阅读更多
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

into_left(&self) 返回 true,则将 self 转换为 Left 变体 (属于 Either<Self, Self>)。 否则将 self 转换为 Right 变体 (属于 Either<Self, Self>)。阅读更多
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

指针的对齐方式。
Source§

type Init = T

初始化器的类型。
Source§

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

使用给定的初始化器初始化 a。阅读更多
Source§

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

解引用给定的指针。阅读更多
Source§

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

可变地解引用给定的指针。阅读更多
Source§

unsafe fn drop(ptr: usize)

丢弃给定指针指向的对象。阅读更多
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

转换出错时返回的类型。
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

执行转换。
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

转换出错时返回的类型。
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

执行转换。