IMG_ReadXPM...rayToRGB888(3)

πŸ’… IMG_ReadXPMFromArrayToRGB888 β€” bestie's guide to loading XPM vibes πŸ’…

okay so this page lives in the SDL_image3 FUNCTIONS manual, and the header abbreviates it as IMG_ReadXPM...rayToRGB888(3) because apparently the full name was too iconic to fit. anyway. let's get into it 🫢


🌸 NAME 🌸

IMG_ReadXPMFromArrayToRGB888 β€” loads an XPM image straight out of a memory array. no files, no drama, just vibes πŸ’–


✨ SYNOPSIS ✨

#include <SDL3_image/SDL_image.h>

SDL_Surface * IMG_ReadXPMFromArrayToRGB888(char **xpm);

πŸŽ€ DESCRIPTION πŸŽ€

so the surface you get back is always a 32-bit RGB surface. like, always always. no cap. it's not gonna switch it up on you.

but bestie, listen β€” if you actually wanted 8-bit indexed colors (and the XPM data is down for it, iykyk), then you should be calling IMG_ReadXPMFromArray() instead. different function, different era πŸ’…

and when you're done with the surface? please, please dispose of it properly with a call to SDL_DestroySurface(). don't just leave it there like an unread group chat 😭


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • xpm β€” a null-terminated array of strings that make up the XPM data. yes, an array of strings, not one big blob. she's structured πŸ’…

🌈 RETURN VALUE 🌈

returns a shiny new SDL_Surface, or NULL on error. if you get NULL, that's your sign to go check what went wrong πŸ™ˆ


⭐ AVAILABILITY ⭐

this function has been serving since SDL_image 3.0.0. she's not new, she's just been quietly slaying πŸ‘‘


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie! source: SDL_image, version SDL_image 3.4.4 πŸ’–βœ¨ go forth and load those XPMs, you've got this 🫢🌸

πŸ“¦ where this page comes from