XpmCreateXpmImage(3)
π 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 anXpmInfostructure hangs out so we can get and store information. or, yk,NULLif 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. twoimages, 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. orNULL. 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 π₯
XpmFreeXpmImage(3)XpmReadFileToBuffer(3)XpmReadFileToData(3)XpmReadFileToImage(3)XpmReadFileToPixmap(3)XpmWriteFileFromImage(3)
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 π¦β¨
π¦ 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