linux x11 rgb565 capture (#8580)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-07-03 14:20:41 +08:00
committed by GitHub
parent 6d2e985593
commit d00582e929
7 changed files with 165 additions and 45 deletions

View File

@@ -82,12 +82,24 @@ extern "C" {
pub fn xcb_get_atom_name_name_length(reply: *const xcb_get_atom_name_reply_t) -> i32;
pub fn xcb_shm_query_version(c: *mut xcb_connection_t) -> xcb_shm_query_version_cookie_t;
pub fn xcb_shm_query_version_reply(
c: *mut xcb_connection_t,
cookie: xcb_shm_query_version_cookie_t,
e: *mut *mut xcb_generic_error_t,
) -> *const xcb_shm_query_version_reply_t;
pub fn xcb_get_geometry_unchecked(
c: *mut xcb_connection_t,
drawable: xcb_drawable_t,
) -> xcb_get_geometry_cookie_t;
pub fn xcb_get_geometry_reply(
c: *mut xcb_connection_t,
cookie: xcb_get_geometry_cookie_t,
e: *mut *mut xcb_generic_error_t,
) -> *mut xcb_get_geometry_reply_t;
}
pub const XCB_IMAGE_FORMAT_Z_PIXMAP: u8 = 2;
@@ -195,6 +207,12 @@ pub struct xcb_void_cookie_t {
pub sequence: u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct xcb_get_geometry_cookie_t {
pub sequence: u32,
}
#[repr(C)]
pub struct xcb_generic_error_t {
pub response_type: u8,
@@ -248,3 +266,18 @@ pub struct xcb_shm_query_version_reply_t {
pub pixmap_format: u8,
pub pad0: [u8; 15],
}
#[repr(C)]
pub struct xcb_get_geometry_reply_t {
pub response_type: u8,
pub depth: u8,
pub sequence: u16,
pub length: u32,
pub root: xcb_window_t,
pub x: i16,
pub y: i16,
pub width: u16,
pub height: u16,
pub border_width: u16,
pub pad0: [u8; 2],
}