Trait ScreenshotProvider
pub trait ScreenshotProvider: Send + Sync {
// Required methods
fn capture_full(&self) -> Result<Screenshot, Error>;
fn capture_region(&self, rect: Rect) -> Result<Screenshot, Error>;
}Expand description
Platform backend trait for screen capture.
Implementors snapshot pixels from a display or a sub-region. They must return physical (device) pixels — never downscaled to logical points — and report the scale factor alongside the pixel buffer.
§Errors
Error::PermissionDeniedwhen the OS denies the capture permission (e.g. macOS Screen Recording).Error::Unsupportedwhen the current session has no capture path (e.g. Linux with neither X11 DISPLAY nor a working Wayland portal).Error::Platformfor raw OS / FFI failures.
Required Methods§
fn capture_full(&self) -> Result<Screenshot, Error>
fn capture_full(&self) -> Result<Screenshot, Error>
Capture the primary display in full.
fn capture_region(&self, rect: Rect) -> Result<Screenshot, Error>
fn capture_region(&self, rect: Rect) -> Result<Screenshot, Error>
Capture a sub-rectangle specified in logical screen coordinates
(the same coordinate space as Rect in Element::bounds).