Crates.io | winc |
lib.rs | winc |
version | 0.3.0 |
source | src |
created_at | 2024-07-17 20:00:15.684262 |
updated_at | 2024-07-18 04:16:33.992208 |
description | Windows screen capture |
homepage | |
repository | https://github.com/TeamDman/winc |
max_upload_size | |
id | 1306548 |
size | 42,529 |
A crate for windows screen capture.
See tests.rs for examples.
#[test]
fn region_screenshots() {
let monitors = get_all_monitors().unwrap();
let mut capturers = Vec::new();
for monitor in monitors {
let p0 = monitor.info.rect.top_left();
let p1 = p0.translate(100, 100);
let region = RECT::from_corners(p0, p1).translate(100, 100);
let capturer = get_monitor_capturer(Rc::new(monitor), region);
capturers.push(capturer);
}
std::fs::create_dir_all("target/capture").unwrap();
let mut images = Vec::new();
for capturer in capturers.iter() {
// capture
let capture = capturer.capture(&mut Metrics::None).unwrap();
// save image
let mon_name_good = capturer.monitor.info.name.replace(r"\\.\", "");
let path = format!("target/capture/region-{}.png", mon_name_good);
capture.save(path).unwrap();
images.push(capture);
}
assert_no_transparency(&images);
}
Some code from https://github.com/TeamDman/Cursor-Hero which used some code from https://github.com/nashaofu/screenshots-rs/ commit 999faac06f85bd93638c2a9cda6cbb25ad9f5c73
My understanding is that the licenses used in our projects are compatible. If something is wrong, please let me know!
The modifications aim to reduce redundant work for successive screen capture calls.
Might also be interesting: