XpmCreateImage(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

πŸ’– XpmCreateImage β€” the libXpm functions glow-up πŸ’–

okay bestie, sit DOWN, because we're about to make XImages out of XPMs and it's genuinely so cute. this page lives in the libXpm functions section of the manual, and it's giving "three functions, one dream" energy. πŸ¦‹


✨ NAME ✨

XpmCreateImage β€” create an XImage from an XPM πŸ’…


🌸 SYNOPSIS 🌸

int XpmCreateImageFromData(Display *display, char **data,
       XImage **image_return, XImage **shapeimage_return,
       XpmAttributes *attributes);

int XpmCreateImageFromBuffer(Display *display, char *buffer,
       XImage **image_return, XImage **shapeimage_return,
       XpmAttributes *attributes);

int XpmCreateImageFromXpmImage(Display *display,  XpmImage *image,
       XImage *image_return, XImage *shapeimage_return,
       XpmAttributes *attributes);

πŸŽ€ ARGUMENTS πŸŽ€

  • display β€” the connection to the X server. your lil phone line to the server, basically πŸ“ž
  • data β€” where the data lives. tell me where the data is, bestie.
  • image_return β€” returns the image which is created. yep, it comes back out through here ✨
  • shapeimage_return β€” returns the shape mask image which is created if the color None is used. no None, no shape mask, that's the vibe.
  • attributes β€” where a structure lives that gets and stores info (or NULL, if you're feeling lowkey and don't want any). πŸ’œ
  • shapeimage β€” the shape mask image which is created if any.

πŸ‘‘ DESCRIPTION πŸ‘‘

🌈 XpmCreateImageFromData

to create an XImage from XPM data, you use XpmCreateImageFromData(). that's it, that's the whole assignment. πŸ“

the XpmCreateImageFromData() function lets you embed in your C program an XPM file that was written out by functions like XpmWriteFileFromImage(3) or XpmWriteFileFromPixmap(3) β€” without reading in the file. no file, no problem. XpmCreateImageFromData() works exactly like XpmReadFileToImage(3) and returns the same way. it just reads data instead of a file. main character but make it data.

and here again, it is the caller's responsibility to free the returned images, the colors, and possibly the data returned into the XpmAttributes structure. yes babe, YOU. you're the one holding the mop. 🧹

πŸ¦‹ XpmCreateImageFromBuffer

to create an XImage from an XPM buffer, use XpmCreateImageFromBuffer(). XpmCreateImageFromBuffer() works the same way as XpmReadFileToImage(3) β€” it just parses the buffer instead of the file. slay, same energy, different source.

⚠️ be aware that the feature provided on some systems by XpmReadFileToImage(3) to deal with compressed files is not available here. compressed files? not invited to this party. πŸ’€

πŸ’… XpmCreateImageFromXpmImage

to create an XImage from an XpmImage, use XpmCreateImageFromXpmImage(). from the given XpmImage and XpmAttributes (if not NULL), XpmCreateImageFromXpmImage() allocates colors and creates X images following the same mechanism as XpmReadFileToImage(3). iconic, consistent, no notes.

when finished, the caller must free:

three cleanups, no cap. do them. 🫢


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie β€” X Version 11, libXpm 3.5.17, this is XpmCreateImage(3) signing off πŸ’– remember to free your images or the leaks will find you, mwah πŸŽ€βœ¨