xcb_shm_get_image(3)

πŸ“¦
version 1.17.0 Β· 5 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_shm_get_image πŸ’–

okay so bestie, we're doing xcb_shm_get_image from the XCB Requests crew, and ngl this one is a whole vibe: it ✨copies data from the specified drawable to the shared memory segment✨. that's it. that's the girl. let's get into it 🫢


🌸 NAME 🌸

xcb_shm_get_image β€” copies data from the specified drawable to the shared memory segment. no cap, that is literally the entire job description πŸ’…


✨ SYNOPSIS ✨

#include <xcb/shm.h>

πŸŽ€ Request function πŸŽ€

xcb_shm_get_image_cookie_t xcb_shm_get_image(xcb_connection_t *conn,
       xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width,
       uint16_t height, uint32_t plane_mask, uint8_t format,
       xcb_shm_seg_t shmseg, uint32_t offset);

πŸ¦‹ Reply datastructure πŸ¦‹

typedef struct xcb_shm_get_image_reply_t {
    uint8_t        response_type;
    uint8_t        depth;
    uint16_t       sequence;
    uint32_t       length;
    xcb_visualid_t visual;
    uint32_t       size;
} xcb_shm_get_image_reply_t;

🌈 Reply function 🌈

xcb_shm_get_image_reply_t
       *xcb_shm_get_image_reply(xcb_connection_t *conn,
       xcb_shm_get_image_cookie_t cookie, xcb_generic_error_t **e);

πŸ‘‘ REQUEST ARGUMENTS πŸ‘‘

  • conn β€” the XCB connection to X11. your link to the mothership, the whole reason any of this works πŸ’œ
  • drawable β€” the drawable we're copying the image OUT of. source material, main character energy ✨
  • x β€” the X coordinate in the drawable to begin copying at. where the snip starts, horizontally πŸ“
  • y β€” the Y coordinate in the drawable to begin copying at. same deal but vertical, bestie πŸ“
  • width β€” the width of the image to copy. how wide we're going πŸŽ€
  • height β€” the height of the image to copy. how tall we're going πŸŽ€
  • plane_mask β€” a mask that determines which planes are used. lowkey just: which planes get invited to the party 🎟️
  • format β€” the format to use for the copy (???). yeah bestie the docs themselves are like "???" here, so I'm not gonna pretend to know better than the manpage πŸ™ˆ
  • shmseg β€” the destination shared memory segment. where the pixels are moving TO 🏑
  • offset β€” the offset in the shared memory segment to copy data to. not at the very start? say less, here's your offset ✨

πŸ’… REPLY FIELDS πŸ’…

  • response_type β€” the type of this reply, and in this case it's XCB_SHM_GET_IMAGE. this field also lives in the xcb_generic_reply_t, and it's the whole trick for telling your replies apart from each other. iykyk πŸ”
  • sequence β€” the sequence number of the last request processed by the X11 server. receipts, basically 🧾
  • length β€” the length of the reply, in words (and a word is 4 bytes, periodt) πŸ“
  • depth β€” the depth of the source drawable. how deep the source runs 🌊
  • visual β€” the visual ID of the source drawable. its little ID card πŸͺͺ
  • size β€” the number of bytes copied. the final count, and she ate πŸ”₯

πŸ“ DESCRIPTION πŸ“

Copy data from the specified drawable to the shared memory segment.

and here's the detail that makes people go "wait, what": the amount of bytes written to the destination image is always equal to the number of bytes read from the shared memory segment. like, that's the rule. no notes. symmetric queen πŸ’–


⭐ RETURN VALUE ⭐

Returns an xcb_shm_get_image_cookie_t. errors have to be handled when you call the reply function, xcb_shm_get_image_reply.

if you'd rather handle errors in the event loop instead, use xcb_shm_get_image_unchecked. see xcb-requests(3) for details. pick your fighter, both are valid 🫢


πŸ’€ ERRORS πŸ’€

this request does never generate any errors. not one. zero. a clean slate, a flawless record, an icon who has never been in drama πŸ™ˆβœ¨


πŸ”₯ SEE ALSO πŸ”₯


🌸 AUTHOR 🌸

Generated from shm.xml. contact xcb@lists.freedesktop.org for corrections and improvements. (yes bestie, if something's off, email the list, they're lovely 🫢)


and that's the whole page!! xcb_shm_get_image(3), straight out of libxcb 1.17.0, X Version 11 energy, delivered to you with love πŸ’œβœ¨ no cap, you're gonna slay this one πŸŽ€