Expand description
§libdrmtap
Safe Rust wrapper around the libdrmtap C library for DRM/KMS screen capture.
§Example
use libdrmtap::DrmTap;
let mut tap = DrmTap::open(None).expect("Failed to open DRM device");
// List displays
let displays = tap.list_displays().unwrap();
for d in &displays {
println!("{}: {}x{}", d.name, d.width, d.height);
}
// Capture a frame
let frame = tap.grab_mapped().expect("Capture failed");
println!("{}x{} stride={}", frame.width(), frame.height(), frame.stride());
// Access pixel data as a byte slice
if let Some(pixels) = frame.data() {
println!("First pixel: {:02x}{:02x}{:02x}",
pixels[2], pixels[1], pixels[0]); // RGB from XRGB
}Structs§
- Config
- Configuration for opening a capture context
- Cursor
- Cursor state. Automatically released on drop.
- Display
- Information about a connected display
- DrmTap
- DRM/KMS screen capture context
- Error
- Error type for libdrmtap operations
- Frame
- A captured frame. Automatically released on drop.
Functions§
- version
- Get the library version as a packed integer:
(major << 16) | (minor << 8) | patch