Crates.io | snappy_sc |
lib.rs | snappy_sc |
version | 0.1.2 |
source | src |
created_at | 2023-04-17 18:59:38.687235 |
updated_at | 2023-04-17 18:59:38.687235 |
description | A minimal crate to take screenshots created for Snappy |
homepage | |
repository | https://github.com/dfaisalmahmood/snappy_sc |
max_upload_size | |
id | 841774 |
size | 16,173 |
snappy_sc
is a minimal, fast and efficient screen capture library written in Rust. The library is designed to work across multiple platforms, although it currently only supports Windows. Further platform support is in development.
This library is used as the core component in the Snappy screen capture application, which is still under active development.
winapi
Ensure you have Rust and Cargo installed on your system. If you don't have them installed, follow the instructions on the official Rust website.
Add snappy_sc
as a dependency in your Cargo.toml
:
[dependencies]
snappy_sc = "0.1.0"
Then, include the library in your Rust code:
extern crate snappy_sc;
To use the snappy_sc
library, you can call the primary screen capture function:
use snappy_sc::{get_focused_display_info, take_screenshot};
fn main() {
let (display_id, width, height) = get_focused_display_info().unwrap();
let options = ScreenshotOptions {
display_id,
region: None,
output_format: OutputFormat::Png,
};
let output: Vec<u8> = take_screenshot(&options).unwrap();
// Process the output here
// for example, save to file
let mut file = File::create("screenshot.png").unwrap();
file.write_all(&output).unwrap();
}
We welcome contributions from the community! If you'd like to contribute to snappy_sc, please follow these steps:
snappy_sc
is released under the MIT License. You are free to use, modify, and distribute the library for both personal and commercial purposes.