waycap-rs 3.0.0

High-level Wayland screen capture library with hardware-accelerated encoding
1
2
3
4
5
6
7
8
9
10
11
12
13
/// Basic example which saves the first frame as a PNG and exits
use waycap_rs::{types::error::Result, Capture, RgbaImageEncoder};

fn main() -> Result<()> {
    simple_logging::log_to_stderr(log::LevelFilter::Trace);
    let mut cap = Capture::new_with_encoder(RgbaImageEncoder::default(), false, 30).unwrap();
    let recv = cap.get_output();
    cap.start().unwrap();

    let img = recv.recv().unwrap();
    img.save("./test.png").unwrap();
    Ok(())
}