xcb_copy_area(3)
π xcb_copy_area β bestie, we're copying areas π
okay so this is a page from the XCB Requests corner of the libxcb manual (that's the X11 C binding situation, iykyk). Buckle up, it's giving "pixel copy-paste but make it β¨protocolβ¨".
πΈ NAME πΈ
xcb_copy_area β copy areas, bestie. that's the whole thing. copy. areas.
β¨ SYNOPSIS β¨
first, the include, because we don't do mystery headers around here:
#include <xcb/xproto.h>
π Request function π
here's the actual function, and yes the signature is long, she's high maintenance but she's worth it:
xcb_void_cookie_t xcb_copy_area(xcb_connection_t *conn,
xcb_drawable_t src_drawable, xcb_drawable_t dst_drawable,
xcb_gcontext_t gc, int16_t src_x, int16_t src_y, int16_t dst_x,
int16_t dst_y, uint16_t width, uint16_t height);
π REQUEST ARGUMENTS π
every single one of these is a vibe check, let's go:
connβ your XCB connection to X11. the main character, honestly.src_drawableβ the source drawable. that's a Window or a Pixmap. this is where the pixels are coming from.dst_drawableβ the destination drawable, also a Window or Pixmap. this is where they're going to. slay.gcβ the graphics context to use. she's the styling, the lewk, the fit.src_xβ the source X coordinate. where in the source we start grabbing.src_yβ the source Y coordinate. same energy, vertical edition.dst_xβ the destination X coordinate. where we drop it off.dst_yβ the destination Y coordinate. you get it.widthβ the width of the area to copy, in pixels.heightβ the height of the area to copy, in pixels.
π¦ DESCRIPTION π¦
bestie it's literally this: copies the specified rectangle from src_drawable to dst_drawable. rectangle in, rectangle out. iconic behaviour, no notes. π
π RETURN VALUE π
you get back an xcb_void_cookie_t. that's it. that's the return.
and here's the thing β errors (if any) are not just handed to you, you have to handle them in the event loop. so don't be out here ignoring your loop, okay? π
but wait, if you'd rather handle errors directly with xcb_request_check instead, use xcb_copy_area_checked. easy swap, different energy. peek at xcb-requests(3) for the details.
π ERRORS π
things that can go wrong, and we are not pretending otherwise:
xcb_drawable_error_tβ the specified drawable (Window or Pixmap) does not exist. she's not here, she never was. πxcb_g_context_error_tβ the specified graphics context does not exist. no gc, no fit, no copy.xcb_match_error_tβsrc_drawablehas a different root or depth thandst_drawable. they don't match and the protocol is not about to pretend they do. mismatch = drama. π«
π SEE ALSO π
xcb-requests(3)β go read it, it's the lore.
π AUTHOR π
generated from xproto.xml. if something's wrong or you wanna improve it, hit up xcb@lists.freedesktop.org for corrections and improvements. they're literally asking, so π«Ά.
reminder bestie: this whole page lives in X Version 11, libxcb 1.17.0 β that's the source and version energy, and that's the sign-off. mwah. πβ¨ππ¦πΈπ
π¦ where this page comes from
- alpine 3.22: libxcb-doc 1.17.0-r0 Β· MIT
- alpine 3.23: libxcb-doc 1.17.0-r1 Β· MIT
- alpine 3.24: libxcb-doc 1.17.0-r2 Β· MIT
- arch rolling: libxcb 1.17.0-1 Β· X11
- centos-stream 10: libxcb-devel 1.17.0-3.el10 Β· X11
- debian trixie: libxcb-doc 1.17.0-2
- fedora 43: libxcb-devel 1.17.0-6.fc43 Β· X11
- fedora 43: libxcb-devel 1.17.0-6.fc43 Β· X11
- fedora 44: libxcb-devel 1.17.0-7.fc44 Β· X11
- fedora 44: libxcb-devel 1.17.0-7.fc44 Β· X11
- nixpkgs unstable: libxcb 1.17.0
- opensuse-leap 16.0: libxcb-devel-doc 1.17.0-160000.2.2 Β· MIT
- ubuntu questing: libxcb-doc 1.17.0-2build1
- ubuntu resolute: libxcb-doc 1.17.0-2ubuntu1
- ubuntu stonking: libxcb-doc 1.17.0-2ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms