Skip to content

`dxcapture` is a library for capturing a Direct3D 11 device on Windows.

License

Notifications You must be signed in to change notification settings

bass-clef/dxcapture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dxcapture

dxcapture is a library for capturing a Direct3D 11 device on Windows.

[dependencies]
dxcapture = "1.0"

Details

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

Optional Features

  • img - Enable features that depend on the image crate

    dxcapture = { version = "1.0", 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");

    Read more with image

  • mat - Enable features that depend on the opencv crate

    dxcapture = { version = "1.0", 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");

    Read more with opencv

Exmaples

Documentation

License

Special Thanks

This crate completed thanks to wgc-rust-demo

About

`dxcapture` is a library for capturing a Direct3D 11 device on Windows.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages