XpmCreateData(3)

πŸ“¦
version 3.5.17 Β· 3 versions
, in centos-stream 10, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute

πŸ’– XpmCreateData(3) πŸ’–

okay bestie, welcome to the libXpm functions corner of the manual, this one is literally called XpmCreateData and it's all about creating a Data structure ✨ buckle up πŸŽ€


✨ NAME ✨

XpmCreateData β€” create an Data structure πŸ’…

(yes, "an Data", she said what she said, we don't edit the queen 🫢)


🌸 SYNOPSIS 🌸

int XpmCreateDataFromImage(Display *display, char ***data_return,
       XImage *image, XImage *shapeimage, XpmAttributes *attributes);

int XpmCreateDataFromPixmap(Display *display, char ***data_return,
       Pixmap pixmap, Pixmap shapemask, XpmAttributes *attributes);

int XpmCreateDataFromXpmImage(char ***data_return, XpmImage *image,
       XpmInfo *info);

three whole entry points, we love a trio πŸ‘‘ no cap


πŸ¦‹ ARGUMENTS πŸ¦‹

  • display β€” the connection to the X server, like your group chat connection but for X πŸ”Œ
  • data_return β€” this one returns the data that gets created, it's giving output parameter energy πŸ’«
  • pixmap β€” the pixmap, that's it, that's the whole vibe πŸ–ΌοΈ
  • shapemask β€” the shape mask pixmap πŸŒ™
  • attributes β€” where a structure lives that's holding information (or NULL, she's flexible like that) πŸ“‹
  • info β€” where a structure lives that you're getting information from πŸ‘€
  • image β€” the image ✨

πŸ’œ DESCRIPTION πŸ’œ

🌈 XpmCreateDataFromImage

so sometimes you're just sitting there and you're like "bestie I need to create an XPM data from an XImage" β€” and for that, you use XpmCreateDataFromImage() πŸ’…

XpmCreateDataFromImage() works exactly the way XpmWriteFileFromImage(3) does, and it returns the same way too. the only glow-up difference? it writes to a single block of malloc'ed data instead of to a file. main character behavior fr fr πŸ”₯

okay and this part matters: it is the caller's responsibility to free that data, using XpmFree(3) when you're finished. not optional, not cute to forget, don't leave it hanging 😭

🌈 XpmCreateDataFromPixmap

XpmCreateDataFromPixmap() creates an XPM data from a Pixmap πŸŽ€

the way it does this is very "I'll delegate": XpmCreateDataFromPixmap() uses XGetImage(3) to get the related X images from the given pixmaps, and those images get passed straight to XpmCreateDataFromImage(). then it destroys the created images using XDestroyImage(3) β€” clean up after yourself, iconic 🧚

and it returns the same errors as XpmCreateDataFromImage(). periodt.

🌈 XpmCreateDataFromXpmImage

XpmCreateDataFromXpmImage() creates an XPM data from an XpmImage 🌸

it writes out the given image to a single block of malloc'ed data in XPM format ✍️ and if there isn't enough working storage allocated, it returns XpmNoMemory 😭, and returns XpmSuccess on success πŸ’–

if the XpmInfo structure pointer you passed is not NULL, then XpmCreateDataFromXpmImage() goes looking for these attributes:

  • XpmExtensions
  • XpmHotspot

and it writes out the related information as well πŸ‘‘

and again, bestie, listen: it is the caller's responsibility to free the data, using XpmFree(3) when finished 🫢


⭐ SEE ALSO ⭐


and that's the whole page, no crumbs left πŸ’… go forth and free your malloc'ed data, bestie, your future self will thank you πŸ™ˆβœ¨

this has been X Version 11, libXpm 3.5.17, brought to you with love and zero memory leaks πŸŽ€πŸ’–πŸ¦‹