Skip to main content

Module screenshot

Module screenshot 

Expand description

Screenshot capture: pixel-level snapshots of the screen or a region.

Screenshot is separate from both the accessibility action layer ([crate::Provider]) and the input-synthesis layer (crate::InputProvider). Backends that only capture pixels do not know how to read the a11y tree, synthesise input, or raise/activate windows — they are pure pixel readers.

§What you get

The caller-facing entry points in the xa11y umbrella crate (xa11y::screenshot(), xa11y::screenshot_region(), xa11y::screenshot_element()) all return a Screenshot carrying raw RGBA8 pixels in physical (device) pixels — the same resolution the compositor renders at. On HiDPI displays that means pixel dimensions exceed the logical bounds you passed in; Screenshot::scale records the ratio. Call Screenshot::to_png or Screenshot::save_png to encode.

§No auto-raise

Capturing an element that is occluded or off-screen returns whatever pixels are at those coordinates — the target window is not raised or activated. If you need the element in the foreground, do that explicitly before calling xa11y::screenshot_element.

Structs§

Screenshot
A captured image: raw RGBA8 pixels plus dimensions and scale.

Traits§

ScreenshotProvider
Platform backend trait for screen capture.