Expand description
Read back what a CRTC is scanning out, and write it to a file.
snapshot() composites the planes bound to a CRTC into an Image the
size of its active mode, reading each plane’s buffer back through a
dma-buf. write_png puts one on disk.
This is a readback path, not a rendering one: it reads buffers that already exist and blends them on the CPU as the display controller would, for planes that are neither cropped nor scaled. What it cannot read – tiled buffers, YUV, anything not host-mappable – it skips with a warning rather than failing the capture, because a screenshot missing its video overlay is more use than no screenshot.
Structs§
- Image
- A premultiplied ARGB8888 image, one
u32per pixel, rows contiguous. - Nv12
Frame - One
NV12frame, as a camera or decoder hands it over.
Enums§
- Capture
Error - What can go wrong capturing or writing a frame.
Functions§
- snapshot
- Read back the current plane composition of
crtc_idinto an image sized to its active mode. - src_
over - Premultiplied
SRC_OVER:dst = src + dst * (1 - src_alpha). - unpremultiply
- Recover straight-alpha channels from a premultiplied pixel.
- write_
jpg - Write
imageas a baseline JPEG. - write_
jpg_ nv12 - Write an
NV12frame as a baseline JPEG, without converting to RGB first. - write_
png - Encode
imageas an 8-bit RGBA PNG atpath, creating or truncating it.