Skip to main content

Crate miniscreenshot_wgpu

Crate miniscreenshot_wgpu 

Source
Expand description

Screenshot integration for the wgpu graphics API.

This crate re-exports the wgpu crate (ensuring version consistency across the workspace) and provides [capture_texture], a synchronous utility for reading a GPU texture back to CPU memory and converting it into a Screenshot.

§Re-export

use miniscreenshot_wgpu::wgpu;

§Feature selection

Enable exactly one compatibility feature to select the wgpu major version:

  • wgpu-28
  • wgpu-29

§How it works

  1. A staging Buffer is created with COPY_DST | MAP_READ usage.
  2. A copy_texture_to_buffer command is encoded and submitted.
  3. The device is polled to completion (blocking).
  4. The staging buffer is mapped, row padding is stripped, and the pixel data is converted to RGBA8 if necessary.

Re-exports§

pub use wgpu_28 as wgpu;

Structs§

CaptureError
A canonical error type shared by all Capture implementations.
Screenshot
A captured screenshot backed by raw RGBA8 pixel data.
WgpuCapture
Borrowed view over a wgpu Texture that implements Capture.

Enums§

WgpuCaptureError
Errors that can occur while capturing a GPU texture.

Traits§

Capture
A self-contained screenshot source (e.g. a system capture session).

Functions§

capture
Capture a screenshot from a wgpu Texture synchronously.