Skip to main content

Crate miniscreenshot

Crate miniscreenshot 

Source
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§

CaptureError
A canonical error type shared by all Capture implementations.
Screenshot
A captured screenshot backed by raw RGBA8 pixel data.

Enums§

CaptureErrorKind
High-level categories of capture failure.
EncodeError
An error that occurred while encoding a screenshot.
ImageFormat
Supported image formats for encoding and saving screenshots.
SaveError
An error that occurred while saving a screenshot to disk.

Traits§

Capture
A self-contained screenshot source (e.g. a system capture session).
CaptureAsync
An async-capable source that can capture a screenshot.
MultiCapture
A Capture source that can capture multiple outputs (screens, monitors).

Type Aliases§

BoxedCapture
Convenience type alias for a boxed, Send-able Capture.
BoxedCaptureAsync
Convenience type alias for a boxed, Send-able CaptureAsync.
DynCapture
Convenience type alias for dynamic dispatch over Capture.
DynCaptureAsync
Convenience type alias for dynamic dispatch over CaptureAsync.
DynMultiCapture
Convenience type alias for dynamic dispatch over MultiCapture.