nx_x11_get_image.nx
buildroot/runtime/nx_x11_get_image.nx
about
nx_x11_get_image.nx -- bits-up X11 GetImage opcode + reply read.
Part of the Nishi-troubleshoots-Nishi self-closing-loop arc.
Pulls pixel data BACK from a drawable so we can save it to disk
+ diff/inspect off-line.
GetImage (opcode 73):
byte 0: 73
byte 1: format (1 = XYPixmap, 2 = ZPixmap)
bytes 2-3: request_length = 5
bytes 4-7: drawable
bytes 8-9: x
bytes 10-11: y
bytes 12-13: width
bytes 14-15: height
bytes 16-19: plane_mask (0xFFFFFFFF for all planes)
Reply (32-byte header + data):
byte 0: 1 (Reply marker)
byte 1: depth
bytes 2-3: sequence
bytes 4-7: reply_length (4-byte units; tells us pixel-data size)
bytes 8-11: visual
bytes 12-31: pad
bytes 32+: pixel data
For ZPixmap on a 24-bit visual, the server typically returns
32-bit-per-pixel data (BGRX or XBGR). Total data bytes =
reply_length * 4. Caller allocates a buffer of width*height*4
+ some slack and we copy the result there.
license_tier: ORIGINAL
genealogy_id: international-research-sources/x_org/xproto_v11_r0
lineage_id: nishi_x11_get_image_q10
dependencies 4 imports · 3 importers
imports: nx_syscalls.nxnx_x11_connect.nxnx_x11_window.nxnx_x11_paint.nx
imported by: nx_desktop_game.nxnx_x11_pixmap_kat_test.nxnx_x11_screenshot.nx
structs
| none |
consts
| 41 | const NX_X11_FMT_Z_PIXMAP: i64 = 2 |
functions
| 44 | func _x11_read_exact(conn: *X11Conn, buf: *u8, n: i64) -> i64 |
| 63 | func nx_x11_get_image(conn: *X11Conn, drawable: i64, |
| 108 | func main() -> i64 |