XpmCreateImage(3)
π 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 colorNoneis used. noNone, no shape mask, that's the vibe.attributesβ where a structure lives that gets and stores info (orNULL, 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:
- the images, using
XDestroyImage(3) - the colors, using
XFreeColors(3) - and possibly the data returned into the
XpmAttributes, usingXpmFreeAttributes(3)
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 πβ¨
π¦ where this page comes from
- centos-stream 10: libXpm-devel 3.5.17-5.el10 Β· MIT AND X11-distribute-modifications-variant
- debian trixie: libxpm-dev 1:3.5.17-1+deb13u1
- fedora 43: libXpm-devel 3.5.17-6.fc43 Β· MIT AND X11-distribute-modifications-variant
- fedora 43: libXpm-devel 3.5.17-6.fc43 Β· MIT AND X11-distribute-modifications-variant
- fedora 44: libXpm-devel 3.5.17-7.fc44 Β· MIT AND X11-distribute-modifications-variant
- fedora 44: libXpm-devel 3.5.17-7.fc44 Β· MIT AND X11-distribute-modifications-variant
- opensuse-leap 16.0: libXpm-devel 3.5.17-160000.4.1 Β· MIT
- opensuse-leap 16.0: libXpm-devel 3.5.17-160000.4.1 Β· MIT
- opensuse-leap 16.0: libXpm-devel 3.5.17-160000.4.1 Β· MIT
- opensuse-leap 16.0: libXpm-devel 3.5.17-160000.4.1 Β· MIT
- ubuntu noble: libxpm-dev 1:3.5.17-1build2
- ubuntu noble: libxpm-dev 1:3.5.17-1ubuntu0.24.04.2
- ubuntu questing: libxpm-dev 1:3.5.17-1build2
- ubuntu resolute: libxpm-dev 1:3.5.17-1build3
- ubuntu resolute: libxpm-dev 1:3.5.17-1ubuntu0.26.04.2
- Copyright (C) 1989-95 GROUPE BULL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms