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

πŸ’– XpmCreatePixmap β€” create a pixmap πŸ’–

okay so bestie, welcome to the libXpm functions section 3 glow-up ✨ this one is all about turning your XPM data into an actual honest-to-god Pixmap, and honestly? it's giving main character energy. let's get into it πŸ’…


✨ SYNOPSIS ✨

int XpmCreatePixmapFromData(Display *display, Drawable d,
       char **data, Pixmap *pixmap_return, Pixmap *shapemask_return,
       XpmAttributes *attributes);

int XpmCreatePixmapFromBuffer(Display *display, Drawable d,
       char *buffer, Pixmap *pixmap_return, Pixmap *shapemask_return,
       XpmAttributes *attributes);

int XpmCreatePixmapFromXpmImage(Display *display, Drawable d,
       XpmImage *image, Pixmap *pixmap_return, Pixmap *shapemask_return,
       XpmAttributes *attributes);

three whole functions, three whole vibes, and yes they all return an int 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • display β€” the connection to the X server, aka your lil hotline to the server itself πŸ’–
  • d β€” which screen the pixmap gets created on πŸ–₯️
  • buffer β€” where the buffer is at πŸ“
  • pixmap_return β€” returns the pixmap that gets created if the color None. yes bestie, that's the wording, we don't make the rules πŸ’€
  • shapemask_return β€” returns the shape mask pixmap that gets created if the color None is used 🎭
  • attributes β€” the location of a structure used to get and store information πŸ“‹
  • image β€” the XpmImage in question πŸ–ΌοΈ

🌸 DESCRIPTION 🌸

πŸ¦‹ XpmCreatePixmapFromData

to create a Pixmap from XPM data, you use XpmCreatePixmapFromData(). this one creates X images using XpmCreateImageFromData(3) so it returns the exact same errors as that function, no cap. and then, on success, it goes ahead and creates the related pixmaps using XPutImage(3), which get handed back to pixmap_return and shapemask_return if they're not NULL, and finally it destroys the created images using XDestroyImage(3) ✨

⚠️ do NOT forget to free the returned pixmaps, the colors, and possibly the data returned into the XpmAttributes structure when you're done. seriously bestie, memory leaks are not the vibe 😭

🧚 XpmCreatePixmapFromBuffer

to create a Pixmap from an XPM buffer, use XpmCreatePixmapFromBuffer(). this function works the same way as XpmReadFileToPixmap(3), it just calls XpmCreateImageFromBuffer(3) instead of XpmReadFileToImage(3). same energy, different call, periodt πŸ’…

πŸ‘‘ XpmCreatePixmapFromXpmImage

XpmCreatePixmapFromXpmImage() creates X images by calling XpmCreateImageFromXpmImage(3) with the given XpmImage and XpmAttributes, then it creates the related pixmaps which get returned to pixmap_return and shapemask_return using XPutImage(3). finally it destroys the X images with XDestroyImage(3) πŸ”₯

when you're finished, the caller must free:

  • the pixmaps, using XFreePixmap(3) πŸ–ΌοΈ
  • the colors, using XFreeColors(3) β€” or the application equivalent function when the standard Xlib functions aren't being used 🎨
  • and possibly the data returned into the XpmAttributes, using XpmFreeAttributes(3) 🧹

🌈 SEE ALSO 🌈


and that's the whole page bestie, you ate that πŸ’– this was X Version 11, libXpm 3.5.17, filed under XpmCreatePixmap(3) β€” go forth and free your pixmaps, ily, mwah πŸ«Άβœ¨πŸŽ€