xcb_copy_area(3)

πŸ“¦
version 1.17.0 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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_drawable has a different root or depth than dst_drawable. they don't match and the protocol is not about to pretend they do. mismatch = drama. 🫠

πŸ“ SEE ALSO πŸ“


πŸ‘‘ 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. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’