跳到主要内容

DxgiDuplicationFrameBuffer

搜索

结构体 DxgiDuplicationFrameBuffer 

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

表示包含像素数据的帧缓冲区。

§示例

// 从捕获会话中获取一帧
let mut buffer = frame.buffer()?;
buffer.save_as_image("screenshot.png", ImageFormat::Png)?;

实现§

Source§

impl<'a> DxgiDuplicationFrameBuffer<'a>

Source

pub const fn new( raw_buffer: &'a mut [u8], width: u32, height: u32, row_pitch: u32, depth_pitch: u32, format: DxgiDuplicationFormat, ) -> Self

构造一个新的 FrameBuffer

Source

pub const fn width(&self) -> u32

获取帧缓冲区的宽度。

Source

pub const fn height(&self) -> u32

获取帧缓冲区的高度。

Source

pub const fn row_pitch(&self) -> u32

获取帧缓冲区的行跨度(row pitch)。

Source

pub const fn depth_pitch(&self) -> u32

获取帧缓冲区的深度跨度(depth pitch)。

Source

pub const fn format(&self) -> DxgiDuplicationFormat

获取帧缓冲区的颜色格式。

Source

pub const fn has_padding(&self) -> bool

检查该缓冲区是否包含填充。

Source

pub fn as_nopadding_buffer<'b>(&'b self, buffer: &'b mut Vec<u8>) -> &'b [u8]

获取不含填充的像素数据。

Source

pub const fn as_raw_buffer(&mut self) -> &mut [u8]

获取原始像素数据,其中可能包含填充。

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>

执行转换。