10个稳定版本
1.1.3 | 2022年3月29日 |
---|---|
1.1.2 | 2022年3月28日 |
1.0.5 | 2022年3月28日 |
1.0.4 | 2022年3月25日 |
#132 在 渲染
每月27次下载
36KB
697 行
dxcapture
dxcapture
是一个用于在Windows上捕获Direct3D 11设备的库。
[dependencies]
dxcapture = "1.1"
详细信息
let device = dxcapture::Device::default();
let capture = dxcapture::Capture::new(&device).unwrap();
let raw = loop {
match capture.get_raw_frame() {
Ok(raw) => break raw,
Err(e) => {
if e == dxcapture::CaptureError::NoTexture {
// async, so sometimes it's not there.
continue;
}
panic!("{}", e);
}
}
};
// taked primary monitor.
// hoge raw
可选特性
-
img
- 启用依赖于image
包的特性dxcapture = { version = "1.1", features = ["img"] }
let device = dxcapture::Device::default(); let capture = dxcapture::Capture::new(&device).unwrap(); let image = capture.wait_img_frame().expect("Failed to capture"); let path = "image.png"; image.data.save(path).expect("Failed to save");
-
mat
- 启用依赖于opencv
包的特性dxcapture = { version = "1.1", features = ["mat"] }
use opencv::prelude::*; use opencv::imgcodecs::{ imwrite, IMWRITE_PNG_STRATEGY_DEFAULT }; let device = dxcapture::Device::default(); let capture = dxcapture::Capture::new(&device).unwrap(); let mat = capture.wait_mat_frame().expect("Failed to capture"); let path = "image.png"; imwrite(path, &mat.data, &vec![IMWRITE_PNG_STRATEGY_DEFAULT].into()).expect("Failed to save");
示例
文档
许可证
特别感谢
此包完成归功于 wgc-rust-demo
依赖项
~132MB
~2M SLoC