Expand description
Core screenshot types for the miniscreenshot ecosystem.
This crate provides the fundamental Screenshot type along with PNG,
PPM, and PGM encoding, and file-saving utilities. It also exposes the
Capture, CaptureAsync, and MultiCapture traits that driver
crates implement.
§Quick start
use miniscreenshot::{Screenshot, ImageFormat};
// Build from raw RGBA8 data
let data = vec![255u8, 0, 0, 255, 0, 255, 0, 255]; // 2×1 red|green pixels
let shot = Screenshot::from_rgba(2, 1, data);
// Encode as PPM bytes
let ppm = shot.encode_ppm();
assert!(ppm.starts_with(b"P6\n"));
// Save to disk — format inferred from extension
// shot.save("output.png").unwrap();Structs§
- Capture
Error - A canonical error type shared by all
Captureimplementations. - Screenshot
- A captured screenshot backed by raw RGBA8 pixel data.
Enums§
- Capture
Error Kind - High-level categories of capture failure.
- Encode
Error - An error that occurred while encoding a screenshot.
- Image
Format - Supported image formats for encoding and saving screenshots.
- Save
Error - An error that occurred while saving a screenshot to disk.
Traits§
- Capture
- A self-contained screenshot source (e.g. a system capture session).
- Capture
Async - An async-capable source that can capture a screenshot.
- Multi
Capture - A
Capturesource that can capture multiple outputs (screens, monitors).
Type Aliases§
- Boxed
Capture - Convenience type alias for a boxed, Send-able
Capture. - Boxed
Capture Async - Convenience type alias for a boxed, Send-able
CaptureAsync. - DynCapture
- Convenience type alias for dynamic dispatch over
Capture. - DynCapture
Async - Convenience type alias for dynamic dispatch over
CaptureAsync. - DynMulti
Capture - Convenience type alias for dynamic dispatch over
MultiCapture.