win_desktop_duplication 0.8.0

easy to use windows desktop duplication api
Documentation
win_desktop_duplication-0.8.0 has been yanked.

Windows Desktop Duplication

This is meant to provide a low latency, low level access to desktop frames for use in applications like Game streaming (e.g., Google Stadia, Microsoft XCloud).

Crate provides convenient wrapper for acquiring gpu textures from windows desktop duplication api. The crate includes some convenient features that the source api does not provide

Usage

#[tokio::main]
fn main() {
    set_process_dpi_awareness();
    co_init();
    let adapter = AdapterFactory::new().get_adapter_by_idx(0).unwrap();
    let output = adapter.get_display_by_idx(0).unwrap();
    let mut dupl = DesktopDuplicationApi::new(adapter, output).unwrap();
    loop {
        // this api send one frame per vsync. the frame also has cursor pre drawn 
        let tex = dupl.acquire_next_vsync_frame().await?;

        // .. use the texture
    }
}

Features

  • VSync when providing frames
  • Auto draw cursor onto the frame
  • Handle desktop switch automatically
  • Convenient functions to copy pixel data in cpu memory
  • Scale and color conversion.