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

πŸ’– XpmCreateXpmImage(3) πŸ’–

okay bestie, welcome to the libXpm functions corner of the manual β€” this is the page about making XpmImages out of literally everything else. no cap, it's giving "one function to build them all" energy ✨


✨ NAME ✨

XpmCreateXpmImage β€” create an Xpm image πŸŽ€


🌸 SYNOPSIS 🌸

int XpmCreateXpmImageFromData(char **data, XpmImage *image,
       XpmInfo *info);

int XpmCreateXpmImageFromBuffer(char *buffer, XpmImage *image,
       XpmInfo *info);

int XpmCreateXpmImageFromImage(Display *display,
       XImage *image, XImage *shapeimage,
       XpmImage *xpmimage, XpmAttributes *attributes);

int XpmCreateXpmImageFromPixmap(Display *display,
       Pixmap *pixmap, Pixmap *shapemask,
       XpmImage *xpmimage, XpmAttributes *attributes);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • data β€” tells us where the data is living. like, the location of it. πŸ“
  • image β€” the location of the image structure, queen. that's where it goes.
  • info β€” where an XpmInfo structure hangs out so we can get and store information. or, yk, NULL if you're not feeling it.
  • display β€” the connection to the X server. your link to the mothership fr.
  • image β€” yes bestie, another one β€” this time it's the X image being used as the source. two images, one page, iconic πŸ’…
  • shapeimage β€” the shape mask image, if there even is one. if any. πŸ™ˆ
  • xpmimage β€” the XPM image that gets created. that's the whole point, babe.
  • attributes β€” the location of a structure holding information. or NULL. your call. 🫢

πŸ‘‘ DESCRIPTION πŸ‘‘

🌈 XpmCreateXpmImageFromBuffer

to make an XpmImage out of an XPM buffer, you use XpmCreateXpmImageFromBuffer(). the XpmCreateXpmImageFromBuffer() function reads the buffer you gave it and fills in the XpmImage structure you gave it. so far so slay.

if the buffer does not contain valid XPM data, it returns XpmFileInvalid. 😭 if insufficient working storage is allocated, it returns XpmNoMemory. on success it returns XpmSuccess. periodt. ✨

if the XpmInfo structure pointer you passed is not NULL, then XpmCreateXpmImageFromBuffer() goes looking for these attributes: XpmReturnComments and XpmReturnExtensions, and it may set the XpmHotspot attribute when returning. as specified in the table (page 28), if the data related to the attributes XpmReturnComments and XpmReturnExtensions can't be returned as requested because of insufficient memory storage, XpmCreateXpmImageFromBuffer() will change the valuemask to mention this and will try to continue. so like… the caller should check on this before accessing requested data. please check. do not skip the check. πŸ™

Note: the valuemask of the passed XpmInfo structure must be set to some valid value, at least zero β€” otherwise unpredictable errors can occur. unpredictable. errors. bestie. set the valuemask. πŸ’€

πŸŽ€ XpmCreateXpmImageFromData

to create an XpmImage from XPM data, use XpmCreateXpmImageFromData(). it fills in the given XpmImage structure from the given data. if the data does not contain valid XPM data, it returns XpmFileInvalid. if insufficient working storage is allocated, it returns XpmNoMemory. on success it returns XpmSuccess. πŸ’–

if the passed XpmInfo structure pointer is not NULL, XpmCreateXpmImageFromData() looks for this attribute: XpmReturnExtensions, and sets possibly the XpmHotspot attribute when returning. as specified in the table (page 28), if the data related to the attribute XpmReturnExtensions cannot be returned as requested because of insufficient memory storage, XpmCreateXpmImageFromData() will change the valuemask to mention this and will try to continue. so the caller should check on this before accessing requested data. again. still. forever. ✨

Note: the valuemask of the passed XpmInfo structure must be set to some valid value, at least zero, otherwise unpredictable errors can occur. yes this is the same note. yes it's here too. yes it matters. 🚨

🧚 XpmCreateXpmImageFromImage

to create an XpmImage from an XImage, use XpmCreateXpmImageFromImage(). from the given X images and XpmAttributes (if not NULL), XpmCreateXpmImageFromImage() creates an XpmImage following the exact same mechanism as XpmWriteFileFromImage(3). same mechanism, different function, we love consistency 🫢

⭐ XpmCreateXpmImageFromPixmap

to create an XpmImage from a Pixmap, use XpmCreateXpmImageFromPixmap(). from the given pixmaps and XpmAttributes (if not NULL), XpmCreateXpmImageFromPixmap() gets the related XImages by calling XGetImage, then hands them over to XpmCreateXpmImageFromImage() to create an XpmImage which is returned to xpmimage. and finally β€” the responsible part β€” it destroys the created X images using XDestroyImage(3). clean up after yourself, main character behavior πŸ’…βœ¨


πŸ”₯ SEE ALSO πŸ”₯


okay that's the whole page bestie, you ate πŸ’– this was brought to you by X Version 11, libXpm 3.5.17, and the letter X πŸŽ€ mwah, go forth and create some Xpm images, ily πŸ¦‹βœ¨